<file_sep>// LOG_LEVELS
// { error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 };
require('./lib/heartbeat');
module.exports = require('./lib/logger')();
<file_sep>const winston = require('winston');
const logger = require('./winston');
const graylog = require('winston-tcp-graylog');

if (!process.env.GRAYLOG_HOST) {
    logger.info("GRAYLOG_HOST not found. Graylog disabled");
} else {
    const graylogOptions = {
        gelfPro: {
            adapterName: 'tcp',
            adapterOptions: {
                host: process.env.GRAYLOG_HOST,
                port: 12201
            }
        },
        level: process.env.GRAYLOG_LOG_LEVEL || process.env.LOG_LEVEL || 'silly',
        timestamp: true,
        handleExceptions: true,
        prettyPrint: true
    };

    logger.add(winston.transports.TcpGraylog, graylogOptions);

    logger.transports.tcpGraylog
        .on('error', (err) => {
            console.log(err);
        });
}

module.exports = logger;
<file_sep>const log = require('./logger')();

const startDate = new Date();
module.exports = () => {
    log.info(process.env.HOSTNAME || "localhost", {
        status: 'running',
        startedAt: startDate,
        uptime: new Date().getTime() - startDate.getTime()
    });
};

setInterval(module.exports, 60 * 1000);
<file_sep>const winston = require('winston');
const logger = require('./graylog');
const Sentry = require('winston-sentry');

logger.add(Sentry, {
    level: 'warn',
    dsn: process.env.SENTRY_DSN,
    timestamp: true,
    handleExceptions: true,
    patchGlobal: true,
    tags: {},
    extra: {}
});

module.exports = logger;
