-
Notifications
You must be signed in to change notification settings - Fork 1
log.addLevel
Grant Carthew edited this page Oct 25, 2024
·
6 revisions
Type: Function
Parameter: levels Object with one or more key / value pairs.
Returns: undefined
Example:
import Perj from 'perj'
const log = new Perj(options)
log.addLevel({ extreme: 1 })
Use the log.addLevel
function to add to the existing levels on the logger object.
See the levels document for more detail.
Adding an extreme
level to a logger object:
import Perj from 'perj'
const log = new Perj()
log.addLevel({ extreme: 1 })
console.dir(log.levels)
/*
{
fatal: 60,
error: 50,
warn: 40,
info: 30,
debug: 20,
trace: 10,
extreme: 1
}
*/
log.level = 'extreme'
log.extreme('vrooooom....')
// {"level":"extreme","lvl":1,"time":1526278553689,"msg":"vrooooom....","data":""}