Skip to content

Commit ce94c02

Browse files
committed
Add more levels
1 parent 5ac22e8 commit ce94c02

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/level.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
'use strict'
22

3-
const { platform } = require('process')
3+
const {
4+
platform,
5+
env: { TERM },
6+
} = require('process')
47

58
// Retrieve error's `level`
69
const getLevel = function({ opts, info }) {
@@ -15,16 +18,24 @@ const getLevel = function({ opts, info }) {
1518
return level
1619
}
1720

18-
const isWindows = platform === 'win32'
21+
const supportsUnicode = platform !== 'win32' || TERM === 'xterm-256color'
1922
// Each level is printed in a different way
2023
const LEVELS = {
24+
debug: {
25+
COLOR: 'blue',
26+
SIGN: supportsUnicode ? '\u2699' : '!',
27+
},
28+
info: {
29+
COLOR: 'green',
30+
SIGN: supportsUnicode ? '\u2139' : 'i',
31+
},
2132
warn: {
2233
COLOR: 'yellow',
23-
SIGN: isWindows ? '\u203C' : '\u26A0',
34+
SIGN: supportsUnicode ? '\u26A0' : '\u203C',
2435
},
2536
error: {
2637
COLOR: 'red',
27-
SIGN: isWindows ? '\u00D7' : '\u2718',
38+
SIGN: supportsUnicode ? '\u2718' : '\u00D7',
2839
},
2940
}
3041

0 commit comments

Comments
 (0)