-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
31 lines (24 loc) · 933 Bytes
/
example.js
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
process.env['DEBUG'] = "*::INFO, *::WARN, *::ERR";
process.env['DEBUG_LOCATION'] = "*::INFO";
process.env['DEBUG_COLORS'] = "true";
process.env['DEBUG_STREAM'] = "stdout";
process.env['DEBUG_WMODULE'] = "15";
process.env['DEBUG_WLEVEL'] = "6";
process.env['DEBUG_WTIMEDIFF'] = "6";
process.env['DEBUG_TIME'] = "ddd, yyyy-mm-dd HH:MM:ss.l";
const debugsx = require('debug-sx');
const version = '1.0';
const debug = {};
debug.fine = debugsx('main::FINE');
debug.info = debugsx('main::INFO');
debug.warn = debugsx('main::WARN');
debug.err = debugsx('main::ERR');
const testobject = { name: 'to', value: '1000' };
debug.info('Start of application, version %s', version);
debug.fine('Test object %o', testobject);
debug.warn('Not implemented yet');
debug.err('There is a problem ... %e', new Error('Problem 1'));
console.log('Hello world');
setTimeout(() => {
debug.info('end of application');
}, 1000);