How to use the @qawolf/config.CONFIG.logLevel function in @qawolf/config

To help you get started, we’ve selected a few @qawolf/config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qawolf / qawolf / packages / logger / src / index.ts View on Github external
import winston from "winston";
import { CONFIG } from "@qawolf/config";

const transports = [];

const formatPrint = winston.format.printf(
  ({ level, message, timestamp }) => `${timestamp} ${level}: ${message}`
);

if (CONFIG.logPath) {
  transports.push(
    new winston.transports.File({
      filename: `${CONFIG.logPath}/${Date.now()}.log`,
      format: winston.format.combine(winston.format.timestamp(), formatPrint),
      level: CONFIG.logLevel || "debug"
    })
  );
} else {
  transports.push(
    new winston.transports.Console({
      level: CONFIG.logLevel || "error",
      format: winston.format.combine(
        winston.format.colorize(),
        winston.format.timestamp(),
        formatPrint
      )
    })
  );
}

export const logger = winston.createLogger({
github qawolf / qawolf / packages / logger / src / Logger.ts View on Github external
const createConsoleTransport = () =>
  new winston.transports.Console({
    level: CONFIG.logLevel || "error",
    format: winston.format.combine(
      winston.format.colorize(),
      winston.format.timestamp(),
      formatPrint
    )
  });