Merge pull request #34011 from schmod/pino-isLevelEnabled

add typings for pino isLevelEnabled() method
This commit is contained in:
Sheetal Nandi
2019-03-20 10:45:23 -07:00
committed by GitHub
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -444,6 +444,11 @@ declare namespace P {
* Flushes the content of the buffer in extreme mode. It has no effect if extreme mode is not enabled.
*/
flush(): void;
/**
* A utility method for determining if a given log level will write to the destination.
*/
isLevelEnabled(level: LevelWithSilent | string): boolean;
}
type LevelChangeEventListener = (lvl: LevelWithSilent | string, val: number, prevLvl: LevelWithSilent | string, prevVal: number) => void;
+1
View File
@@ -91,6 +91,7 @@ logstderr.error('on stderr instead of stdout');
log.useLevelLabels = true;
log.info('lol');
log.level === 'info';
const isEnabled: boolean = log.isLevelEnabled('info');
const extremeDest = pino.extreme();
const logExtreme = pino(extremeDest);