К
Size: a a a
К
j
timestamp, level and category will be coloured according to the log event's level
j
S
IS
IS
S
IS
IS
ША
IS
MB
MB
MB
MB
К
S
IS
IS
j
const styles = {
// styles
bold: [1, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
// grayscale
white: [37, 39],
grey: [90, 39],
black: [90, 39],
// colors
blue: [34, 39],
cyan: [36, 39],
green: [32, 39],
magenta: [35, 39],
red: [91, 39],
yellow: [33, 39]
}
function colorizeStart (style) {
return style ? `\x1B[${styles[style][0]}m` : ''
}
function colorizeEnd (style) {
return style ? `\x1B[${styles[style][1]}m` : ''
}
function colorize (str, style) {
return colorizeStart(style) + str + colorizeEnd(style)
}
const log4js = require('log4js')
const logger = log4js.getLogger()
logger.level = 'debug'
logger.debug(`default ${colorize('green!', 'green')} default`)