Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50676 views
1
/*
2
* default-exceptions.js: A test fixture for logging exceptions with the default winston logger.
3
*
4
* (C) 2011 Charlie Robbins
5
* MIT LICENCE
6
*
7
*/
8
9
var path = require('path'),
10
winston = require('../../../lib/winston');
11
12
winston.exitOnError = function (err) {
13
return err.message !== 'Ignore this error';
14
};
15
16
winston.handleExceptions([
17
new (winston.transports.File)({
18
filename: path.join(__dirname, '..', 'logs', 'exit-on-error.log'),
19
handleExceptions: true
20
})
21
]);
22
23
setTimeout(function () {
24
throw new Error('Ignore this error');
25
}, 1000);
26