-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·31 lines (26 loc) · 959 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
const stdout = process.stdout
const DEFAULT = '\x1b[m'
const BLUE = '\x1b[1;36m'
const GREEN = '\x1b[1;92m'
const GREY = '\x1b[1;90m'
const YELLOW = '\x1b[1;33m'
const RED = '\x1b[1;91m'
function colored(augment, color, ...args) {
stdout.write(color)
augment.apply(this, args)
stdout.write(DEFAULT)
}
console.debug = colored.bind(this, console.debug, GREY)
console.info = colored.bind(this, console.info, BLUE)
console.success = colored.bind(this, console.log, GREEN)
console.warn = colored.bind(this, console.warn, YELLOW)
console.error = colored.bind(this, console.error, RED)
console.part = {
debug: colored.bind(stdout, stdout.write, GREY),
error: colored.bind(stdout, stdout.write, RED),
log: colored.bind(stdout, stdout.write, DEFAULT),
info: colored.bind(stdout, stdout.write, BLUE),
success: colored.bind(stdout, stdout.write, GREEN),
warn: colored.bind(stdout, stdout.write, YELLOW),
}
export default console