-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathtest.js
75 lines (54 loc) · 2.22 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require('./console-trace')
require('./console-trace')({}) // should work even if I require it twice
process.stdout.write('\n');
;['error', 'log', 'info', 'warn'].forEach(function (name) {
process.stdout.write(' ');
console[name]('regular console.%s, no clue where it came from', name);
});
process.stdout.write('\n---------------------------------------------------------\n\n');
;['error', 'log', 'info', 'warn'].forEach(function (name) {
process.stdout.write(' ');
console.traced[name]('this is a traced console.%s', name);
});
process.stdout.write('\n---------------------------------------------------------\n\n');
console.traceOptions.colors = false;
;['error', 'log', 'info', 'warn'].forEach(function (name) {
process.stdout.write(' ');
console.traced[name]('this is an uncolored traced console.%s', name);
});
process.stdout.write('\n---------------------------------------------------------\n\n');
console.traceOptions.right = true;
console.traceOptions.colors = true;
;['error', 'log', 'info', 'warn'].forEach(function (name) {
process.stdout.write(' ');
console.traced[name]('this is a colored right aligned traced console.%s', name);
});
process.stdout.write('\n---------------------------------------------------------\n\n');
console.traceOptions.always = true;
console.traceOptions.colors = false;
;['error', 'log', 'info', 'warn'].forEach(function (name) {
process.stdout.write(' ');
console[name]('this is an uncolored right aligned traced console.%s', name);
});
process.stdout.write('\n---------------------------------------------------------\n\n');
require('./console-trace')({
colors: {
log: '35',
warn: '35',
error: '35',
trace: '35',
info: '35'
}
})
;['error', 'log', 'info', 'warn', 'trace'].forEach(function (name) {
process.stdout.write(' ');
console.traced[name]('this is a magenta traced console.' + name);
});
process.stdout.write('\n---------------------------------------------------------\n\n');
console.traceOptions.colors = true;
process.stdout.write(' ');
console.traced.log({ 1: 'works', 2: 'with', 3: 'Object' });
process.stdout.write(' ');
console.traced.log(['Works', 'with', 'Array']);
process.stdout.write(' ');
console.traced.log('Works with Buffer', Buffer('FooBar'));