mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Revert 00a357cd70 to fix logging
This commit is contained in:
parent
6bcc1cfc62
commit
e28f3692ca
4 changed files with 0 additions and 167 deletions
|
|
@ -52,7 +52,6 @@
|
||||||
"prefer-const": 2,
|
"prefer-const": 2,
|
||||||
"prefer-spread": 2,
|
"prefer-spread": 2,
|
||||||
"prefer-template": 2,
|
"prefer-template": 2,
|
||||||
"no-console": 0,
|
|
||||||
"no-unused-vars" : "warn"
|
"no-unused-vars" : "warn"
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
|
|
@ -125,7 +124,6 @@
|
||||||
"Checklists": true,
|
"Checklists": true,
|
||||||
"Settings": true,
|
"Settings": true,
|
||||||
"InvitationCodes": true,
|
"InvitationCodes": true,
|
||||||
"Winston":true,
|
|
||||||
"JsonRoutes": true,
|
"JsonRoutes": true,
|
||||||
"Authentication": true,
|
"Authentication": true,
|
||||||
"Integrations": true,
|
"Integrations": true,
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@
|
||||||
"es6-promise": "^4.1.0",
|
"es6-promise": "^4.1.0",
|
||||||
"meteor-node-stubs": "^0.2.6",
|
"meteor-node-stubs": "^0.2.6",
|
||||||
"os": "^0.1.1",
|
"os": "^0.1.1",
|
||||||
"winston": "^2.3.1",
|
|
||||||
"winston-zulip": "0.0.6",
|
|
||||||
"xss": "^0.3.3"
|
"xss": "^0.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
Meteor.startup(() => {
|
|
||||||
Winston = require('winston');
|
|
||||||
require('winston-zulip');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
//remove default logger
|
|
||||||
Winston.remove(Winston.transports.Console);
|
|
||||||
|
|
||||||
const loggerEnable = process.env.LOGGER_ENABLE || true;
|
|
||||||
if (loggerEnable) {
|
|
||||||
|
|
||||||
Winston.log('info', 'logger is enable');
|
|
||||||
const loggers = process.env.LOGGERS ? process.env.LOGGERS.split(',') : 'console';
|
|
||||||
|
|
||||||
if (loggers.includes('console')) {
|
|
||||||
Winston.add(Winston.transports.Console, {
|
|
||||||
json: true,
|
|
||||||
timestamp: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loggers.includes('file')) {
|
|
||||||
//create logs directory
|
|
||||||
fs.mkdir('logs', (err) => {
|
|
||||||
if (err) throw err;
|
|
||||||
});
|
|
||||||
|
|
||||||
const fileName = `logs/${process.env.LOGGER_FILE_NAME}` || 'logs/server.log';
|
|
||||||
|
|
||||||
Winston.add(Winston.transports.File, {
|
|
||||||
filename: fileName,
|
|
||||||
json: true,
|
|
||||||
options: {
|
|
||||||
flags: 'a+',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loggers.includes('zulip')) {
|
|
||||||
const loggerZulipUsername = process.env.LOGGER_ZULIP_USERNAME;
|
|
||||||
const loggerZulipApikey = process.env.LOGGER_ZULIP_APIKEY;
|
|
||||||
const loggerZulipRealm = process.env.LOGGER_ZULIP_REALM;
|
|
||||||
const loggerZulipTo = process.env.LOGGER_ZULIP_TO || 'logs';
|
|
||||||
const loggerZulipSubject = process.env.LOGGER_ZULIP_SUBJECT || 'wekan';
|
|
||||||
|
|
||||||
const zulipConfig = {
|
|
||||||
zulipUsername: loggerZulipUsername,
|
|
||||||
zulipApikey: loggerZulipApikey,
|
|
||||||
zulipRealm: loggerZulipRealm,
|
|
||||||
zulipTo: loggerZulipTo,
|
|
||||||
zulipSubject: loggerZulipSubject,
|
|
||||||
};
|
|
||||||
|
|
||||||
Winston.add(Winston.transports.Zulip, zulipConfig);
|
|
||||||
|
|
||||||
Winston.log('info', `zulipconfig ${zulipConfig}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Winston.log('info', 'Logger is completly instanciate');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
class Message {
|
|
||||||
constructor(userId, type, method, doc, selector, fieldNames, modifier) {
|
|
||||||
this.userId = userId;
|
|
||||||
this.type = type;
|
|
||||||
this.method = method;
|
|
||||||
this.doc = doc;
|
|
||||||
this.selector;
|
|
||||||
this.fieldNames = fieldNames;
|
|
||||||
this.modifier = modifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------- CARDS --------------------
|
|
||||||
Cards.before.update(function (userId, doc, fieldNames, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'card', 'update', doc, null, fieldNames, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
Cards.before.remove(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'card', 'remove', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Cards.before.insert(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'card', 'insert', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Cards.before.upsert(function (userId, selector, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'card', 'update', null, selector, null, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//------------- BOARDS --------------------
|
|
||||||
Boards.before.update(function (userId, doc, fieldNames, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'board', 'update', doc, null, fieldNames, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
Boards.before.remove(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'board', 'remove', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Boards.before.insert(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'board', 'insert', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Boards.before.upsert(function (userId, selector, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'board', 'update', null, selector, null, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
//------------- LISTS --------------------
|
|
||||||
Lists.before.update(function (userId, doc, fieldNames, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'list', 'update', doc, null, fieldNames, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
Lists.before.remove(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'list', 'remove', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Lists.before.insert(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'list', 'insert', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Lists.before.upsert(function (userId, selector, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'list', 'update', null, selector, null, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//------------- CARD COMMENTS --------------------
|
|
||||||
CardComments.before.update(function (userId, doc, fieldNames, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'card-comments', 'update', doc, null, fieldNames, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
CardComments.before.remove(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'card-comments', 'remove', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
CardComments.before.insert(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'card-comments', 'insert', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
CardComments.before.upsert(function (userId, selector, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'card-comments', 'update', null, selector, null, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//------------- USERS --------------------
|
|
||||||
Users.before.update(function (userId, doc, fieldNames, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'user', 'update', doc, null, fieldNames, modifier));
|
|
||||||
});
|
|
||||||
|
|
||||||
Users.before.remove(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'user', 'remove', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Users.before.insert(function (userId, doc) {
|
|
||||||
Winston.log('info', new Message(userId, 'user', 'insert', doc));
|
|
||||||
});
|
|
||||||
|
|
||||||
Users.before.upsert(function (userId, selector, modifier, options) {
|
|
||||||
Winston.log('info', new Message(userId, 'user', 'update', null, selector, null, modifier));
|
|
||||||
});
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue