From 51e579e3b4f15b59c8f22dbbc7a1e6894f9552ae Mon Sep 17 00:00:00 2001 From: Alexei Mikhailov Date: Fri, 11 Feb 2022 14:30:22 +0200 Subject: [PATCH] Add `flush` function to types After 5e31678 `Logger` doesn't allow arbitrary properties anymore, which revealed that types are missing `.flush` function definition --- pino.d.ts | 5 +++++ test/types/pino.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pino.d.ts b/pino.d.ts index c46d18ab3..52d7bd480 100644 --- a/pino.d.ts +++ b/pino.d.ts @@ -102,6 +102,11 @@ interface LoggerExtras extends EventEmitter { * Returns an object containing all the current bindings, cloned from the ones passed in via logger.child(). */ bindings(): pino.Bindings; + + /** + * Flushes the content of the buffer when using pino.destination({ sync: false }). + */ + flush(): () => void; } diff --git a/test/types/pino.ts b/test/types/pino.ts index af424863e..9065bee11 100644 --- a/test/types/pino.ts +++ b/test/types/pino.ts @@ -1,6 +1,6 @@ import { pino } from '../../pino' import { join } from 'path' -import { tmpdir } from'os' +import { tmpdir } from 'os' const destination = join( tmpdir(), @@ -14,6 +14,7 @@ const transport = pino.transport({ }) const logger = pino(transport) logger.info('test2') +logger.flush() const transport2 = pino.transport({ target: 'pino-pretty',