From 60617405513766f4e959a90dd52710b6ea358ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cruz?= Date: Mon, 23 Dec 2024 00:25:01 +0000 Subject: [PATCH] Expose `pino` so that it can be used for the root logger --- README.md | 3 +-- src/index.js | 1 + types/index.d.ts | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ebd6d68..80f61d4 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,7 @@ You may also set the log level via the `LOG_LEVEL` environment variable. However Every call to `debino` creates a child logger based on a root logger. The default root logger is an instance returned by `pino()`, without any options. You may set your own root logger by calling `setRootLogger()`: ```js -import pino from 'pino'; -import debino, { setRootLogger } from '@uphold/debino'; +import debino, { setRootLogger, pino } from '@uphold/debino'; // Call this as soon as possible in your application. setRootLogger(pino({ redact: ['foo'] })); diff --git a/src/index.js b/src/index.js index 23202dd..6681e83 100644 --- a/src/index.js +++ b/src/index.js @@ -84,4 +84,5 @@ setRootLogger(pino()); */ module.exports = debino; +module.exports.pino = pino; module.exports.setRootLogger = setRootLogger; diff --git a/types/index.d.ts b/types/index.d.ts index 2e41192..2b3ccd8 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,7 +1,8 @@ -import { Logger, ChildLoggerOptions } from "pino"; - -export function setRootLogger(logger: Logger) +import { Logger, ChildLoggerOptions, pino } from "pino"; declare function debino(namespace: string, options?: { prefix?: string, suffix?: string } & ChildLoggerOptions): Logger +declare function setRootLogger(logger: Logger) + export default debino; +export { setRootLogger, pino }