I experienced the same type of bugg that you describe. I came to the conclusion that the default logger var winston = require('winston') does not work with query , stream functions and is not an EventEmitter , so you can use winston.on('logging', function() {...})
The solution you need to use is to create an instance of your own registrar as follows:
var logger = new (winston.Logger)({ transports: [ new (winston.transports.Console)({ level: 'info' }), new (winston.transports.File)({ filename: 'app.log' }) ] });
and then do some logging:
setInterval(function(){ logger.log('info', 'logging some stuff..'); }, 500);
then you can transfer already registered recordings using stream :
logger.stream().on('log', function(log) { console.log('>>> ', log); });
I think you misunderstood the stream function, because it does not record journal entries on the fly, it simply transfers all the records that you have already registered. To connect an event to your registrar, you can use the "logging" event on the log object:
logger.on('logging', function (transport, level, msg, meta) { // [msg] and [meta] have now been logged at [level] to [transport] console.log("[%s] and [%s] have now been logged at [%s] to [%s]", msg, JSON.stringify(meta), level, transport.name); });
I donβt know why this is not supported by the default registrar, and, as I said at the beginning of this post, I get errors inside the asynchronous library (winston dependency) when using the query or stream function with the default registrar.