I know it's a very abstract question, but I just don't know where/how to start.
I am using bunyan as a logging library in my app. This is a sample syntax for logging something:
const log = bunyan.createLogger({...});
log.info(...);
log.error(...);
I want to create some kind of a wrapper so that every time log.<something>()
is called, it will execute the functionality from my module. Specifically, I want to do a curl
request with the object produced by log.<something>()
.
I was looking into messina and gelf-stream which are wrappers around bunyan
but I didn't really spot any specific code that handles logging events or anything that will give me an example of how to accomplish my idea.
I was thinking of adding event emitters to bunyan
that I can listen for in my module, but that would require me to my fork of the lib, and I don't wanna do that. So, now I'm out of ideas.