Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50676 views
1
/*
2
* log-exceptions.js: A test fixture for logging exceptions in 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', 'exception.log'),
16
handleExceptions: true
17
})
18
]
19
});
20
21
logger.handleExceptions();
22
23
setTimeout(function () {
24
throw new Error('OH NOES! It failed!');
25
}, 1000);
26