unilog-nexus

Aggregates debug, nlogger and console output into unilog.

unilog-nexus

Aggregates debug, nlogger and console output into the unilog node.js module.

node.js projects rely on plenty of modules and many of them use distinct log facilities. Having a unified log output is difficult and configuring the log output is even worse.

unilog aims to unify logging and unilog-nexus allows you to redirect the log output of some well-known log modules into unilog.

It's just a single line of code!

Put this code at the very beginning of your node.js project to ensure that all supported log libraries are correctly hooked.

require('unilog-nexus')();

You can disable hooking of specific libraries if you want to.

require('unilog-nexus')({
    console: false,
    debug:   false,
    nlogger: false,
});

This section roughly describes the mapping between the redirected module and unilog.

  • No group id will be provided to unilog.
  • console.error()unilog.error()
  • console.info()unilog.info()
  • console.log()unilog.info()
  • console.warn()unilog.warn()
  • require('debug')('a:b:c')require('unilog').withGroupId('a.b.c')
  • debug()unilog.debug()
  • require('nlogger').logger(module)require('unilog').withModule(module)
  • nlogger.debug()unilog.debug()
  • nlogger.error()unilog.error()
  • nlogger.info()unilog.info()
  • nlogger.trace()unilog.trace()
  • nlogger.warn()unilog.warn()

The original implementations aren't lost! Just in case you need them for some quick debugging.

  • console.error()console.log.raw()
  • console.info()console.info.raw()
  • console.log()console.log.raw()
  • console.warn()console.warn.raw()
  • require('debug')('xyz')require('debug').raw('xyz') or
  • debug('log message')debug.raw('log message')
  • require('nlogger').logger(module)require('nlogger').raw(module)
$ npm install unilog-nexus
$ npm install
$ npm test

Support this project by providing redirector implementations for even more node.js log modules.

  • Add support for util.debuglog() and the debuglog module.
  • Implement even more redirectors.

MIT