"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;
|