all files / configs/ logger.js

100% Statements 17/17
100% Branches 0/0
100% Functions 4/4
100% Lines 17/17
8 statements, 4 functions Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                               
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var logger = require("bunyan");
var path = require("path");
var bunyan = logger.createLogger({
    name: 'generatr',
    serializers: logger.stdSerializers,
    streams: [
        {
            type: 'file',
            path: path.join(__dirname, '../../debug-log.json'),
        },
    ],
});
// Make sure that uncaught exceptions are logged before exiting
/* istanbul ignore next */
process.on('uncaughtException', function (err) {
    console.log(err);
    /* istanbul ignore next */
    bunyan.fatal(err, 'Uncaught exception');
});
/* istanbul ignore next */
process.on('exit', function (code) {
    console.log(code);
    /* istanbul ignore next */
    bunyan.error({ exitCode: code }, "Exiting with status code: " + code);
});
/* istanbul ignore next */
process.on('warning', function (warning) {
    console.log(warning);
    /* istanbul ignore next */
    bunyan.warn(warning, 'Warning triggered');
});
/* istanbul ignore next */
process.on('unhandledRejection', function (error) {
    console.log(error);
    /* istanbul ignore next */
    bunyan.fatal(error, "Unhandled rejection: " + error.message);
});
exports.default = bunyan;