Skip to content

Commit a18f45b

Browse files
committed
added support for multiple arguments to the logger
1 parent 142a46d commit a18f45b

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/logger.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1+
/* eslint-disable no-console */
12
import chalk from 'chalk'
23

34
const Logger = {
4-
log(msg) {
5-
/* eslint-disable no-console */
6-
return console.log(chalk.green(JSON.stringify(msg)))
7-
/* eslint-enable no-console */
5+
log(...msg) {
6+
return console.log(chalk.green('[Info]'), ...msg)
87
},
9-
error(msg) {
10-
/* eslint-disable no-console */
11-
return console.error(chalk.bold.red(JSON.stringify(msg)))
12-
/* eslint-enable no-console */
8+
error(...msg) {
9+
return console.error(chalk.bold.red('[Error]'), ...msg)
1310
},
14-
warn(msg) {
15-
/* eslint-disable no-console */
16-
return console.warn(chalk.keyword('orange')(JSON.stringify(msg)))
17-
/* eslint-enable no-console */
11+
warn(...msg) {
12+
return console.warn(chalk.keyword('orange')('[Warn]'), ...msg)
13+
},
14+
debug(...msg) {
15+
return console.warn(chalk.blue('[Debug]'), ...msg)
1816
},
1917
}
2018

0 commit comments

Comments
 (0)