-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
47 lines (34 loc) · 821 Bytes
/
index.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var fs = require('fs');
var ERROR = 0;
var WARN = 1;
var INFO = 2;
var loggingLevel = ERROR;
module.exports.ERROR = 0;
module.exports.WARN = 1;
module.exports.INFO = 2;
function ASLog() {
process.on('exit', function(code) {
console.log('exit with code: ' + code);
});
};
ASLog.prototype.instance = undefined;
ASLog.prototype.setLevel = function(level) {
loggingLevel = level;
};
ASLog.prototype.error = function(message) {
console.log('ERROR[AS]: ' + message);
};
ASLog.prototype.warn = function(message) {
if (loggingLevel < WARN) return;
console.log('WARN[AS]: ' + message);
};
ASLog.prototype.info = function(message) {
if (loggingLevel < INFO) return;
console.log('info[AS]: ' + message);
};
module.exports = function() {
if (!this.instance) {
instance = new ASLog();
}
return instance;
}