kengz/spacy-nlp

View on GitHub
src/log.js

Summary

Maintainability
A
0 mins
Test Coverage
const winston = require("winston");

/* istanbul ignore next */
logLevel = process.env["npm_config_debug"] ? "debug" : "info";
const log =
  global.log ||
  new winston.Logger({
    level: logLevel,
    transports: [
      new winston.transports.Console({
        formatter: options => {
          /* istanbul ignore next */
          return `[${new Date()}] ${winston.config.colorize(
            options.level,
            options.level.toUpperCase()
          )} ${options.message || ""}`;
        }
      })
    ]
  });

module.exports = log;