trentm / node-bunyan

a simple and fast JSON logging module for node.js services
Other
7.17k stars 516 forks source link

adding custom function to bunyan logger #659

Closed farhad-taran closed 3 years ago

farhad-taran commented 3 years ago

is there any way of adding a custom function to the bunyan logger, either an extension method or using inheritance?

I am trying the following atm with no success and getting the following error:

Error:(9, 18) TS2339: Property 'debugInPlace' does not exist on type 'import("/Users/farhad/Source/lib-core/node_modules/@types/bunyan/index.d.ts")'.
import Logger  from 'bunyan';

declare module 'bunyan' {
    interface Logger {
        debugInPlace(featureRole: string, ...params:any[]): void;
    }
}

Logger.prototype.debugInPlace = function (this: Logger, featureRole: string, ...params:any[]) {

}