add typings for pino isLevelEnabled() method

This commit is contained in:
Andrew Schmadel
2019-03-19 17:06:59 -04:00
parent 67e641be9b
commit a5e81b2ecc
2 changed files with 6 additions and 0 deletions

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;

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);