How to use the winston.level function in winston

To help you get started, we’ve selected a few winston 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 OpenTMI / opentmi / test / unittests / routes / schemas.js View on Github external
/* eslint-disable func-names, prefer-arrow-callback, no-unused-expressions */

// Third party components
const {expect} = require('chai');
const logger = require('winston');

// Local components
const SchemaRoute = require('../../../app/routes/schemas');

// Setup
logger.level = 'error';


describe('routes/schemas.js', function () {
  describe('Route', function () {
    it('should define a parameter handler for Collection parameter', function (done) {
      const app = {
        use: (router) => {
          expect(router).to.have.property('params');
          expect(router.params).to.have.property('Collection');
          done();
        }
      };

      SchemaRoute(app);
    });
github alphagov / pay-selfservice / test / integration / transaction_details_ft_tests.js View on Github external
before(function () {
        // Disable logging.
        winston.level = 'none';
    });
github vpdb / server / app.js View on Github external
}).then(() => {

		// set log level
		logger.info('[app] Setting log level to "%s".', config.vpdb.logging.level);
		logger.level = config.vpdb.logging.level;

		// now we start the server.
		logger.info('[app] Starting Express server at %s:%d', app.get('ipaddress'), app.get('port'));
		app.listen(app.get('port'), app.get('ipaddress'), function() {
			logger.info('[app] Storage API ready at %s', settings.storageProtectedUri());
			logger.info('[app] API ready at %s', settings.apiUri());
			if (process.send) {
				process.send('online');
			}
		});

	}).catch(err => {
		logger.error('[app] ERROR: %s', err.message);
github aerobatic / aerobatic-cli / bin / aero.js View on Github external
return () => {
    if (process.env.NODE_ENV === 'development' || program.debug) {
      winston.level = 'debug';
    }

    // Don't require config until after NODE_ENV has been set
    const config = require('config');

    log.debug('Config environment is %s', config.util.getEnv('NODE_ENV'));

    _.defaults(program, {
      cwd: process.cwd(),
      customerId: process.env.AERO_CUSTOMER,
      subCommand: (commandOptions || {}).subCommand
    });

    // Run the command
    require('../lib/cli-init')(program, commandOptions)
      .then(() => command(program))
github heyanger / nodejs-vue-postgresql / server / core / logger.js View on Github external
const winston = require('winston')

winston.level = 'debug'
const logger = new (winston.Logger)({
  transports: [
    // colorize the output to the console
    new (winston.transports.Console)({
      colorize: true,
      prettyPrint: true
    })
  ]
})

module.exports = logger
github microsoft / ApplicationInsights-node.js / Tests / FunctionalTests / TestApp / Tasks / Winston.js View on Github external
var winston= require('winston');
winston.level = 'silly';

function logFn(type) {
    return (callback) => {
        winston.log(type, `test ${type}`);
        callback();
    }
}

function logFn2(type) {
    return (callback) => {
        winston[type](`test ${type}`);
        callback();
    }
}
github angular / dgeni / spec / config.spec.js View on Github external
beforeEach(function() {
    logLevel = log.level;
    log.level = 'warn';

    defaultConfig = new Config({ array: [ 'a', 'b' ] });
    mockConfigFile = function(config) {
      config.a = 'x';
      config.array[1] = 'y';
      return config;
    };

    requireSpy = jasmine.createSpy('require').andReturn(mockConfigFile);
    oldRequire = configurer.__get__('require');
    configurer.__set__('require', requireSpy);
  });
github yahoo / athenz / libs / nodejs / auth_core / src / token / Token.js View on Github external
constructor() {
    winston.level = config.logLevel;

    ATHENZ_TOKEN_MAX_EXPIRY = (Number(config.tokenMaxExpiry) > 30 * 24 * 60 * 60) ? 30 * 24 * 60 * 60 : Number(config.tokenMaxExpiry);
    ATHENZ_TOKEN_NO_EXPIRY = config.tokenNoExpiry;

    this._unsignedToken = null;
    this._signedToken = null;
    this._version = null;
    this._salt = null;
    this._host = null;
    this._ip = null;
    this._domain = null;
    this._signature = null;
    this._keyId = '0';
    this._expiryTime = 0;
    this._timestamp = 0;
    this._digestAlgorithm = 'SHA256';
github shavo007 / serverless-nodejs-starter / src / logger.js View on Github external
import winston from 'winston'

winston.level = process.env.LOG_LEVEL || 'info'
const handleExceptions = process.env.NODE_ENV !== 'dev'

const logger = winston.createLogger({
    level: winston.level,
    transports: [
        new winston.transports.Console({
            handleExceptions,
            humanReadableUnhandledException: handleExceptions,
            level: 'debug'
        })
    ],
    exitOnError: false
})

export default logger