All files / src logger.ts

66.66% Statements 4/6
0% Branches 0/8
0% Functions 0/1
60% Lines 3/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 171x     1x                 1x        
import winston from "winston";
import { CliConfig } from "./cli/cli-config";
 
export const logger = winston.createLogger({
  level: "info",
  transports: [
    new winston.transports.Console({
      format: winston.format.combine(winston.format.colorize(), winston.format.simple()),
    }),
  ],
});
 
export const setLoggingLevelFromConfig = (config: CliConfig): void => {
  const newLevel = config.level ?? (config.debug ? "debug" : config.verbose ? "verbose" : "info");
  logger.level = newLevel;
};