javascript - Piping debug.js output through winston -
at company we've been using winston while our own logs it's become cumbersome deal other libraries' logs use debugjs, such knex.js. thinking if there anyway pipe knex's debug output through winston couldn't come anything.
what woould best way have piped through out winston loggers?
cheers!
depends on want log.
you can wire knex.on('query', ...), knex.on('query-response', ...), knex.on('query-error', ...) printout sent queries:
http://knexjs.org/#interfaces-events more info found in answer tracking db querying time - bookshelf/knex
we using kind of solution track slow queries , transactions.
if want move internal console.logs go winston, monkey patching knex helpers https://github.com/tgriesser/knex/blob/master/src/helpers.js or global console.log pretty option.
Comments
Post a Comment