-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
54 lines (39 loc) · 1.15 KB
/
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
47
48
49
50
51
52
53
54
var fs = require('fs');
var styleme = require('styleme');
class logger {
constructor(config) {
this.lvl = config.level || 0;
this.presets = config.presets || {};
this.path = config.path + "/" + Date.now + ".txt";
this.init();
}
init() {
}
log( /**/ ) {
arguments = Array.prototype.slice.call(arguments);
var i = 0;
var options = this.presets;
if (typeof arguments[0] == "object") {
i = 1;
var opt = arguments[0];
for (var i in opt) options[i] = opt[i] || options[i];
}
for (; i < arguments.length; i++) {
var text = arguments[i],
head = options.head || "";
if (options.style) text = text.styleMe();
console.log(head + text);
if (!options.log && (!options.logCat || options.logCat <= this.lvl)) this._log(text, head, options)
}
}
debug( /**/ ) {
}
_log(txt, head, options) {
}
tracer() {
var error = new Error();
var stack = error.stack;
if (!stack) return false;
stack = stack.split("\n")
}
}