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
Currently if meta has circular references, logging breaks with some nasty infinite recursion. I think this is probably worth fixing at least for the fact that logging shouldn't bring down an application, no matter how dumb the developer was for passing in a self-referencing object (and yes, I was that dumb).
I'd just do something like this at the top of Syslog.prototype.log():
if (meta){
try {
meta = JSON.stringify(data);
} catch(ex){
meta = " NOTE: Could not stringify meta: " + JSON.stringify(ex);
}
}
...but you might have a smarter way. It seems like the problem could manifest in winston.clone(), so you might want to fix this in winston itself instead, but this fix makes the otherwise unsafe stringify() on 119 safe too.
The text was updated successfully, but these errors were encountered:
Currently if meta has circular references, logging breaks with some nasty infinite recursion. I think this is probably worth fixing at least for the fact that logging shouldn't bring down an application, no matter how dumb the developer was for passing in a self-referencing object (and yes, I was that dumb).
I'd just do something like this at the top of Syslog.prototype.log():
if (meta){
try {
meta = JSON.stringify(data);
} catch(ex){
meta = " NOTE: Could not stringify meta: " + JSON.stringify(ex);
}
}
...but you might have a smarter way. It seems like the problem could manifest in winston.clone(), so you might want to fix this in winston itself instead, but this fix makes the otherwise unsafe stringify() on 119 safe too.
The text was updated successfully, but these errors were encountered: