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.

27 lines
718 B

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