Skip to content

Commit

Permalink
Expose pino so that it can be used for the root logger
Browse files Browse the repository at this point in the history
  • Loading branch information
satazor authored and fixe committed Dec 23, 2024
1 parent 87bbb26 commit 6061740
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'] }));
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ setRootLogger(pino());
*/

module.exports = debino;
module.exports.pino = pino;
module.exports.setRootLogger = setRootLogger;
7 changes: 4 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -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 }

0 comments on commit 6061740

Please sign in to comment.