jamsyoung
8/11/2014 - 1:58 AM

winston-loggly.js - Dead simple library for a node app to use winston and loggly with the log level set by an environment variable.

winston-loggly.js - Dead simple library for a node app to use winston and loggly with the log level set by an environment variable.

'use strict';

var
    Loggly = require('winston-loggly').Loggly,
    logger,
    logLevel = process.env.LOGLEVEL || 'info',
    winston = require('winston');

logger = new winston.Logger({
    transports: [
        new winston.transports.Console({
            colorize: true,
            level: logLevel
        }),
        new winston.transports.Loggly({
            inputToken: 'YOUR-TOKEN-HERE',
            json: true,
            level: logLevel,
            stripColors: true,
            subdomain: 'YOUR-SUBDOMAIN-HERE',
            tags: ['YOUR-TAG-HERE']
        })
    ]
});


module.exports = logger;