2017-04-28 21:47:07 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2018-06-15 20:45:58 +08:00
|
|
|
|
2020-09-01 20:07:56 +08:00
|
|
|
export default function (type, logDescription, logCode = 'was_not_provided', extraInfo = {}, userInfo = {}) {
|
2020-05-01 04:40:45 +08:00
|
|
|
const connectionId = this.connection.id;
|
2019-06-29 05:40:06 +08:00
|
|
|
const logContents = {
|
|
|
|
logCode,
|
|
|
|
logDescription,
|
2020-05-01 04:40:45 +08:00
|
|
|
connectionId,
|
2019-06-29 05:40:06 +08:00
|
|
|
extraInfo,
|
|
|
|
userInfo,
|
|
|
|
};
|
2018-06-15 20:45:58 +08:00
|
|
|
|
2019-06-29 05:40:06 +08:00
|
|
|
// If I don't pass message, logs will start with `undefined`
|
|
|
|
Logger.log({ message: JSON.stringify(logContents), level: type });
|
2020-09-01 20:07:56 +08:00
|
|
|
}
|