-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
32 lines (23 loc) · 1011 Bytes
/
test.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
31
32
var Logger = require('./index.js'),
basicFormat = require('./lib/utilities').format;
var globalLogger = Logger.getGlobal();
globalLogger.getParent().setLevel(Logger.Level.ALL);
globalLogger.severe("OPERATIONAL!");
var testLogger = Logger.getLogger('test');
var basicFormatter = new Logger.Formatter();
basicFormatter.format = function(record) {
var msg = this.formatMessage(record);
return basicFormat('[{0,date,full}] ({1}.{2}) {3}',[new Date(record.getMillis()),record.getSourceClassName(),record.getSourceMethodName(),msg]);
}
testLogger._log = function() {
Logger.prototype._log.apply(this,arguments);
setTimeout(function(record){
console.info(basicFormatter.format(record));
},100,arguments[0])
}
testLogger.setLevel(Logger.Level.ALL);
testLogger.entering("Someplace","Nearby");
testLogger.entering("Someplace","Nearby","Today");
testLogger.entering("Someplace","Nearby",["Today","Yesterday","Tomorrow"]);
testLogger.exiting("Someplace","Nearby",true);
testLogger.severe("test");