You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
989 B

  1. // const _ = require('lodash')
  2. const winston = require('winston')
  3. /* global WIKI */
  4. module.exports = {
  5. loggers: {},
  6. init(uid) {
  7. let logger = winston.createLogger({
  8. level: WIKI.config.logLevel,
  9. format: winston.format.combine(
  10. winston.format.colorize(),
  11. winston.format.label({ label: uid }),
  12. winston.format.timestamp(),
  13. winston.format.printf(info => `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`)
  14. )
  15. })
  16. // Init Console (default)
  17. let loggerConsoleModule = require(`../modules/logging/console`)
  18. loggerConsoleModule.init(logger)
  19. this.loggers['console'] = loggerConsoleModule
  20. // _.forOwn(_.omitBy(WIKI.config.logging.loggers, s => s.enabled === false), (loggerConfig, loggerKey) => {
  21. // let loggerModule = require(`../modules/logging/${loggerKey}`)
  22. // loggerModule.init(logger, loggerConfig)
  23. // this.loggers[logger.key] = loggerModule
  24. // })
  25. return logger
  26. }
  27. }