You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm planning to write a new winston transport; looking at the log method example in the readme it seems that the log method has to fire a logged event, but since I like to understand what I'm writing rather than simply to cut&paste code, I have some question about it.
This is the log method example in the readme:
log(info,callback){setImmediate(()=>{this.emit('logged',info);});// Perform the writing to the remote servicecallback();}
Why should logged event be fired? I would have thought that callback was enough.
Why should it be fired within a setImmediate?
The name is confusing me. I would have expected to fire something like logging before writing data to the remote service and something like logged later. Is it ok that logged event should be fired before writing the data to the remote service?
Thank you,
iCC
The text was updated successfully, but these errors were encountered:
setImmediate pushes the function to the callback queue, stack is prioritized over callback queue so if you don't use timers to send your logs to a remote service, setImmediate function is most likely to execute last.
Hi all,
I'm planning to write a new winston transport; looking at the
log
method example in the readme it seems that thelog
method has to fire alogged
event, but since I like to understand what I'm writing rather than simply to cut&paste code, I have some question about it.This is the
log
method example in the readme:logged
event be fired? I would have thought that callback was enough.setImmediate
?logging
before writing data to the remote service and something likelogged
later. Is it ok thatlogged
event should be fired before writing the data to the remote service?Thank you,
iCC
The text was updated successfully, but these errors were encountered: