[pino] add levelKey option, deprecate changeLevelName option (#42887)

This commit is contained in:
Andrew van Rooyen
2020-03-09 11:03:09 -07:00
committed by GitHub
parent b645f4e7cc
commit e80317f940
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for pino 5.15
// Type definitions for pino 5.17
// Project: https://github.com/pinojs/pino.git, http://getpino.io
// Definitions by: Peter Snider <https://github.com/psnider>
// BendingBender <https://github.com/BendingBender>
@@ -227,6 +227,10 @@ declare namespace P {
/**
* Changes the property `level` to any string value you pass in. Default: 'level'
*/
levelKey?: string;
/**
* (DEPRECATED, use `levelKey`) Changes the property `level` to any string value you pass in. Default: 'level'
*/
changeLevelName?: string;
/**
* Use this option to define additional logging levels.
+1
View File
@@ -77,6 +77,7 @@ pino({
pino({ base: null });
pino({ base: { foo: 'bar' }, changeLevelName: 'severity' });
pino({ base: { foo: 'bar' }, levelKey: 'severity' });
if ('pino' in log) console.log(`pino version: ${log.pino}`);
log.child({ a: 'property' }).info('hello child!');