-
Notifications
You must be signed in to change notification settings - Fork 1
levelKeyEnabled
The levelKeyEnabled
option turns on the levelKey in the JSON output.
The levelKeyEnabled
option is used to enable or disable the "level" key in the JSON output. For example, setting the levelKeyEnabled
option to false
will produce an output from the logger of:
{"lvl":30,"time":1525643291716,"msg":"You have advanced to the next level!","data":""}
If you set the levelKeyEnabled
options to 'true' or leave it at the default value, then the output from the logger would look like:
{"level":"info","lvl":30,"time":1525643291716,"msg":"You have advanced to the next level!","data":""}
Warning: Do not set both the levelKeyEnabled
and the levelNumberKeyEnabled options to false
or you will not be able to tell at what level the log output was made.
This example changes the levelKeyEnabled
from the default value of true
to false
:
import Perj from 'perj'
const log = new Perj({ levelKeyEnabled: false })
log.info('You have advanced to the next level!')
/*
Standard out will be:
{"lvl":30,"time":1525643291716,"msg":"You have advanced to the next level!","data":""}
*/