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
My application has formatters, which are slow.
When I run my application with level=info to get rid of debug logs in production, I notice that the formatter is ran for those debug logs, causing a considerable performance hit - even though level is info.
Please let me know if there is a way to work around this, or am I just misunderstanding winston and formatters. Thanks!
Here is my profiler:
Here is my minimal-ish reproducible:
constwinston=require('winston');constlogger=winston.createLogger({level: 'info',format: winston.format.combine(winston.format.json(),winston.format((input)=>{letlagger=0;for(leti=0;i<1000000000;i++){lagger+=1;}returninput;})()),defaultMeta: {service: 'user-service'},transports: [newwinston.transports.Console({format: winston.format.simple(),})],});setInterval(()=>{// I still see formatter for this log in profiler taking up some secondslogger.debug('Hello world!');},1000);
What version of Winston presents the issue?
v3.13.0
What version of Node are you using?
v18.18.0
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
Posted above
Additional information
No response
The text was updated successfully, but these errors were encountered:
馃攷 Search Terms
Slow formatter
The problem
My application has formatters, which are slow.
When I run my application with
level=info
to get rid of debug logs in production, I notice that the formatter is ran for thosedebug
logs, causing a considerable performance hit - even though level isinfo
.Please let me know if there is a way to work around this, or am I just misunderstanding winston and formatters. Thanks!
Here is my profiler:
Here is my minimal-ish reproducible:
What version of Winston presents the issue?
v3.13.0
What version of Node are you using?
v18.18.0
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
Posted above
Additional information
No response
The text was updated successfully, but these errors were encountered: