Monkey patch the node js bunyan logging

111 Views Asked by At

Do you have an idea on how to monkey patch the node js bunyan methods like info, debug by using shimmer(https://www.npmjs.com/package/shimmer) ?

For example, this is my bunyan configuration:

let bunyanLog = require('bunyan')
let bunyanOpts = {
  name : "bunyan-logging",
  level : "debug"
}

let bunyanLogger = bunyanLog.createLogger(bunyanOpts)

So, in my app I can call

bunyanLogger.info('info message') // output: info message

I want to monkey patch this bunyanLogger.info() by adding another functionality. So when executing the bunyanLogger.info() we also send a Facebook/Slack notifications.

I could not find articles or tutorials in the net about monkey patching the bunyan. Thanks!

0

There are 0 best solutions below