node.js - Winston logging with HAPI does not work -


i have project winston logging enabled , project uses hapi. have following code:

    logger.js     ---------      var winston = require('winston');     winston.emiterrs = true;      var logger = new winston.logger({         transports: [             new winston.transports.console({                 level: 'debug',                 json: false,                 colorize: true             })         ],         exitonerror: false     });      module.exports = logger;     module.exports.stream = {       write: function(message, encoding){           logger.info(message);       }     };      server.js     ---------      var hapi = require('hapi');     var logger = require('./conf/logger.js');      var server = new hapi.server({     });      server.connection({        port: 3000     });      server.register([require('./modules/healthcheck.js'), require('vision')], (err) => {       if (err) {           console.error('failed load plugin:', err);       }     });      server.start(function () {         logger.info('server started @ ' + server.info.uri);     });      healthcheck.js     --------------      var logger = require('./conf/logger.js');      var healthchkplugin = {       register: function (server, options, next) {         server.route({           method: 'get',           path: '/',           handler: function (request, reply) {             logger.info("health check api invoked");             reply("gateway , running");           }         });         next();       }     }      healthchkplugin.register.attributes = {       name: 'healthchkplugin',       version: '0.0.1'     };      module.exports = healthchkplugin; 

when run server.js , hit end point request, console shows following:

info: server started @ http://<>:3000

but expected show info statement specified in handler. doing wrong here ?


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -