-
Notifications
You must be signed in to change notification settings - Fork 1
/
2-console-overrides-on-built-in-methods.js
61 lines (53 loc) · 1.24 KB
/
2-console-overrides-on-built-in-methods.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
var consolate = require('../lib/index.js')
consolate.init({
error: {
color: consolate.colors.red,
prefix: {
chars: 'ERROR:',
color: consolate.colors.red
}
},
info: {
color: consolate.colors.cyan,
prefix: {
chars: 'INFO:',
color: consolate.colors.lightCyan
}
},
log: {
color: consolate.colors.lightBlue,
prefix: {
chars: '-->',
color: consolate.colors.darkGray
}
},
trace: {
color: consolate.colors.white
},
warn: {
color: consolate.colors.yellow,
prefix: {
chars: 'WARNING:',
color: consolate.colors.lightYellow
}
}
})
console.log()
console.error('The error method is now RED with anger!')
setTimeout(() => {
console.log()
console.info('The info method is now FYI in a CYAN kind of way.')
}, 1500)
setTimeout(() => {
console.log()
console.log('The log method now has a new twist.')
}, 3000)
setTimeout(() => {
console.log()
console.trace('This trace auto-adopts the error override along with its own customizaton')
}, 4500)
setTimeout(() => {
console.log()
console.warn('The warn method is now brave, even if it is a little YELLOW.')
console.log()
}, 6000)