Fix creation of pino children
This commit is contained in:
parent
353eafceb8
commit
77c7c8d6ed
1 changed files with 6 additions and 4 deletions
|
@ -132,11 +132,11 @@ export const log: LoggerType = {
|
|||
info: pinoInstance.info.bind(pinoInstance),
|
||||
debug: pinoInstance.debug.bind(pinoInstance),
|
||||
trace: pinoInstance.trace.bind(pinoInstance),
|
||||
child: createLogger.bind(pinoInstance),
|
||||
child: child.bind(pinoInstance),
|
||||
};
|
||||
|
||||
export function createLogger(name: string): LoggerType {
|
||||
const instance = pinoInstance.child({}, { msgPrefix: `[${name}] ` });
|
||||
function child(this: typeof pinoInstance, name: string): LoggerType {
|
||||
const instance = this.child({}, { msgPrefix: `[${name}] ` });
|
||||
|
||||
return {
|
||||
fatal: instance.fatal.bind(instance),
|
||||
|
@ -145,10 +145,12 @@ export function createLogger(name: string): LoggerType {
|
|||
info: instance.info.bind(instance),
|
||||
debug: instance.debug.bind(instance),
|
||||
trace: instance.trace.bind(instance),
|
||||
child: createLogger.bind(instance),
|
||||
child: child.bind(instance),
|
||||
};
|
||||
}
|
||||
|
||||
export const createLogger = log.child;
|
||||
|
||||
/**
|
||||
* Sets the low-level logging interface. Should be called early in a process's
|
||||
* life.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue