-
Notifications
You must be signed in to change notification settings - Fork 1
dateTimeKey
Grant Carthew edited this page Oct 25, 2024
·
5 revisions
The dateTimeKey
option enables you to change the JSON key used for the date / time output.
The dateTimeKey
option is used to change the key used in the output JSON for the date / time value. For example, the default dateTimeKey
of 'time' will produce an output from the logger of:
{"level": "info", "lvl": 30, "time": 12345,...
If you set the dateTimeKey
option to 'dt' then the output from the logger would look like:
{"level": "info", "lvl": 30, "dt": 12345,...
This example changes the dateTimeKey
from the default of 'time' to 'dt':
import Perj from 'perj'
const log = new Perj({ dateTimeKey: 'dt' })
log.info('You have advanced to the next level!')
/*
Standard out will be:
{"level":"info","lvl":30,"dt":1525643291716,"msg":"You have advanced to the next level!","data":""}
*/