bigbluebutton-Github/bigbluebutton-html5/imports/startup/server/logger.js

34 lines
792 B
JavaScript
Raw Normal View History

import { Meteor } from 'meteor/meteor';
import { createLogger, format, transports } from 'winston';
import WinstonPromTransport from './prom-metrics/winstonPromTransport';
const LOG_CONFIG = Meteor?.settings?.private?.serverLog || {};
2019-08-03 01:20:06 +08:00
const { level } = LOG_CONFIG;
const Logger = createLogger({
2019-08-03 01:20:06 +08:00
level,
format: format.combine(
2018-12-10 09:08:16 +08:00
format.colorize({ level: true }),
format.splat(),
format.simple(),
),
2019-08-03 01:20:06 +08:00
transports: [
// console logging
new transports.Console({
prettyPrint: false,
humanReadableUnhandledException: true,
colorize: true,
handleExceptions: true,
level,
}),
// export error logs to prometheus
new WinstonPromTransport({
level: 'error',
}),
2019-08-03 01:20:06 +08:00
],
});
export default Logger;
2017-06-03 03:25:02 +08:00
export const logger = Logger;