Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isLevelEnabled to common logger interface #126

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/logging/commonLogger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import type { BaseLogger, Bindings, ChildLoggerOptions } from 'pino'

export type CommonLogger = BaseLogger & {
/**
* Creates a child logger, setting all key-value pairs in `bindings` as properties in the log lines. All serializers will be applied to the given pair.
* Child loggers use the same output stream as the parent and inherit the current log level of the parent at the time they are spawned.
* If a `level` property is present in the object passed to `child` it will override the child logger level.
*
* @param bindings: an object of key-value pairs to include in log lines as properties.
* @param options: an options object that will override child logger inherited options.
* @returns a child logger instance.
*/
child(bindings: Bindings, options?: ChildLoggerOptions): CommonLogger

/**
* A utility method for determining if a given log level will write to the destination.
*/
isLevelEnabled(level: string): boolean
}
Loading