We use a helper function to log messages to both our server log, as well as a log that clients can see. It's essentially:
function our_log(data: any, message: string) {
// log using bunyan
log.info({ requestId, ...data }, message)
// log to client
database.append_log_to_client(message)
}
This works well, but breaks when we set src: true in our Bunyan configuration. Suddenly, all log lines think they're coming from our_log, instead of the callee function. Is there a way to tell Bunyan to log the src as being x stack frames higher up the call stack?
We use a helper function to log messages to both our server log, as well as a log that clients can see. It's essentially:
This works well, but breaks when we set
src: true
in our Bunyan configuration. Suddenly, all log lines think they're coming fromour_log
, instead of the callee function. Is there a way to tell Bunyan to log the src as beingx
stack frames higher up the call stack?