1.1.12 • Published 6 years ago
bellman v1.1.12
Bellman
Yet another console logger. A pretty and powerful one, though.
yarn add bellman
Methods
reg
- registers the file from which logging methods will be called to adjust the width of the:caller
row
Default config
const Logger = require('bellman')
new Logger()
.reg()
.info('info message')
.debug('debug message')
.warn('warning message')
.error('error: %s', new Error())
Custom config
const Logger = require('bellman')
const userConfig = {
timeTmp: 'HH:mm',
lineTmp: ':level :time :caller :message',
colorize: true,
callerColor: 'yellow.bold',
levelMap: {
debug: 'blue',
info: 'green',
panic: 'red'
},
levelMin: 'debug',
isFullStack: true
}
new Logger(userConfig)
.reg()
.info('info line')
.debug('debug line')
.panic('panic line: %s', new Error())
Config
lineTmp
- sets the logging line format. Supported placeholders::time
- a timestamp in the format defined by thetimeTmp
config option:level
- a name of the logging method that has been called:caller
- a name of the file and a number of the line from which the logging method has been called:message
- a formatted message combined from the arguments passed to the logging method (util.format is used to fromat messages)
timeTmp
- sets the timestamp format (moment is used to format timestamps)colorize
- overrides whether the coloring should be used or not (chalk is used for colorization)callerColor
- sets the:caller
part color.levelMap
- sets the names, priorities, and colors of the logging methodslevelMin
- sets the logging levelisFullStack
- sets whether the error stack formatter should be used or not- if unset, all the lines that refer files out of the project's directory and all the files within
node_modules
directories will be removed - if set, no modifications will be applied to the error-stacks
isFullStack
may be overridden withSTACK=full
andFULLSTACK=true
environment variables
- if unset, all the lines that refer files out of the project's directory and all the files within
Events
log
- emits metadata of a logged line:time
- a formateed timestamplevel
- a name of the logged message that has been calledcaller
- a name of the file and a number of the line from which the logging method has been calledmessage
- a formatted messageargs
- arguments passed the logged message
1.1.12
6 years ago
1.1.11
6 years ago
1.1.10
6 years ago
1.1.9
6 years ago
1.1.8
9 years ago
1.1.7
9 years ago
1.1.6
9 years ago
1.1.5
9 years ago
1.1.4
9 years ago
1.1.3
9 years ago
1.1.2
9 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.11
10 years ago
1.0.9
10 years ago
1.0.8
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago