Replace the built-in Sails.js logger with Bunyan
This hook allows you to use Bunyan with your Sails.js project. It's a drop-in, API-compatible replacement for Sails' built-in Captain's Log, so you do not need to rewrite all your logging code in order to make use of Bunyan.
sails.log
in now an object which is obtained by calling bunyan.createLogger()
. Your log.js config file now becomes a bunyan-compatible config file that is passed as-is to the above method. This is the only thing you might have to update after installing this hook (because bunyan has different log levels than Captain's Log).
Also, if you need it, you can access the original bunyan
module at sails.hooks.logger.bunyan
.
Just add this npm module into your Sails' package.json:
$ npm install --save sails-hook-bunyanlog
This software is licensed under the BSD-3-Clause License. See the LICENSE file for more information.