index.js
function (done) {
      var config = sails.config[this.configKey];

      _this = this;

      // If a rotationSignal is given, listen for it
      if (config.rotationSignal) {
        process.on(config.rotationSignal, function () {
          _this.logger.reopenFileStreams();
        });
      }

      // If logUncaughtException is set, log those, too
      if (config.logUncaughtException) {
        process.on('uncaughtException', function (err) {
          _this.logger.fatal({ err: err }, 'Uncaught exception');
          process.exit(1);
        });
      }

      // save off injectRequestLogger for middleware route
      injectRequestLogger = sails.config[this.configKey].injectRequestLogger;

      // Inject log methods
      var log = sails.log = this.logger.debug.bind(this.logger);

      Object.keys(logLevels).forEach(function (sailsLevel) {
        var bunyanLevel = logLevels[sailsLevel];
        if (bunyanLevel) {
          log[sailsLevel] = function () {
            var logger = config.getLogger();
            logger[bunyanLevel].apply(logger, arguments);
          };
        } else {
          // no-op
          log[sailsLevel] = function () {};
        }
      });

      done();
    }
function (done) {
      var config = sails.config[this.configKey];

      _this = this;

      // If a rotationSignal is given, listen for it
      if (config.rotationSignal) {
        process.on(config.rotationSignal, function () {
          _this.logger.reopenFileStreams();
        });
      }

      // If logUncaughtException is set, log those, too
      if (config.logUncaughtException) {
        process.on('uncaughtException', function (err) {
          _this.logger.fatal({ err: err }, 'Uncaught exception');
          process.exit(1);
        });
      }

      // save off injectRequestLogger for middleware route
      injectRequestLogger = sails.config[this.configKey].injectRequestLogger;

      // Inject log methods
      var log = sails.log = this.logger.debug.bind(this.logger);

      Object.keys(logLevels).forEach(function (sailsLevel) {
        var bunyanLevel = logLevels[sailsLevel];
        if (bunyanLevel) {
          log[sailsLevel] = function () {
            var logger = config.getLogger();
            logger[bunyanLevel].apply(logger, arguments);
          };
        } else {
          // no-op
          log[sailsLevel] = function () {};
        }
      });

      done();
    }
function ( done ) { var config = sails . config [ this . configKey ] ; _this = this ; // If a rotationSignal is given, listen for it if ( config . rotationSignal ) { process . on ( config . rotationSignal , function ( ) { _this . logger . reopenFileStreams ( ) ; } ) ; } // If logUncaughtException is set, log those, too if ( config . logUncaughtException ) { process . on ( 'uncaughtException' , function ( err ) { _this . logger . fatal ( { err : err } , 'Uncaught exception' ) ; process . exit ( 1 ) ; } ) ; } // save off injectRequestLogger for middleware route injectRequestLogger = sails . config [ this . configKey ] . injectRequestLogger ; // Inject log methods var log = sails . log = this . logger . debug . bind ( this . logger ) ; Object . keys ( logLevels ) . forEach ( function ( sailsLevel ) { var bunyanLevel = logLevels [ sailsLevel ] ; if ( bunyanLevel ) { log [ sailsLevel ] = function ( ) { var logger = config . getLogger ( ) ; logger [ bunyanLevel ] . apply ( logger , arguments ) ; } ; } else { // no-op log [ sailsLevel ] = function ( ) { } ; } } ) ; done ( ) ; }
Hook initialization function.
Hook initialization function .