Baphomet is the dedicated bot for nulloctet matrix
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.

29 lines
805 B

  1. let winston = require('winston');
  2. let logger = winston.createLogger({
  3. level: 'info',
  4. format: winston.format.combine(
  5. winston.format.timestamp(),
  6. winston.format.splat(),
  7. winston.format.json()
  8. ),
  9. defaultMeta: { service: 'baphomet-js' },
  10. transports: [
  11. new winston.transports.File({ filename: 'log/error.log', level: 'error' }),
  12. new winston.transports.File({ filename: 'log/combined.log' })
  13. ]
  14. });
  15. if (process.env.NODE_ENV !== 'production') {
  16. logger.add(new winston.transports.Console({
  17. format: winston.format.combine(
  18. winston.format.simple()
  19. )
  20. }));
  21. }
  22. if ('LOG_LEVEL' in process.env) {
  23. logger.info('LOG_LEVEL:', process.env.LOG_LEVEL)
  24. logger.level = process.env.LOG_LEVEL
  25. }
  26. exports.logger = logger;