Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50665 views
1
/*
2
* unhandle-exceptions.js: A test fixture for using `.unhandleExceptions()` winston.
3
*
4
* (C) 2011 Charlie Robbins
5
* MIT LICENCE
6
*
7
*/
8
9
var path = require('path'),
10
winston = require('../../../lib/winston');
11
12
var logger = new (winston.Logger)({
13
transports: [
14
new (winston.transports.File)({
15
filename: path.join(__dirname, '..', 'logs', 'unhandle-exception.log'),
16
handleExceptions: true
17
})
18
]
19
});
20
21
logger.handleExceptions();
22
logger.unhandleExceptions();
23
24
setTimeout(function () {
25
throw new Error('OH NOES! It failed!');
26
}, 1000);
27