|
@@ -6,14 +6,21 @@ const winston = require('winston')
|
|
|
module.exports = {
|
|
|
loggers: {},
|
|
|
init(uid) {
|
|
|
- let logger = winston.createLogger({
|
|
|
+ const loggerFormats = [
|
|
|
+ winston.format.label({ label: uid }),
|
|
|
+ winston.format.timestamp()
|
|
|
+ ]
|
|
|
+
|
|
|
+ if (WIKI.config.logFormat === 'json') {
|
|
|
+ loggerFormats.push(winston.format.json())
|
|
|
+ } else {
|
|
|
+ loggerFormats.push(winston.format.colorize())
|
|
|
+ loggerFormats.push(winston.format.printf(info => `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`))
|
|
|
+ }
|
|
|
+
|
|
|
+ const logger = winston.createLogger({
|
|
|
level: WIKI.config.logLevel,
|
|
|
- format: winston.format.combine(
|
|
|
- winston.format.colorize(),
|
|
|
- winston.format.label({ label: uid }),
|
|
|
- winston.format.timestamp(),
|
|
|
- winston.format.printf(info => `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`)
|
|
|
- )
|
|
|
+ format: winston.format.combine(...loggerFormats)
|
|
|
})
|
|
|
|
|
|
// Init Console (default)
|