Changelog - 2026-07-17
Logger Correctness Pass
Bug Fix Enhancement Behavior ChangeIn one line. Color appears on the console only, JSON mode emits valid JSON, the log level is configurable, files are written only when you ask, and a lost UDP log line cannot crash the process.
What changed
- ANSI-free log files. The console colorizes; files and UDP get the same line plain. JSON mode emits valid JSON, and
errors({ stack: true })now takes effect. APP_ENV_LOGGER_LEVELsets the level floor. Defaultdebug, so current behavior is kept. Transports without their own level inherit it. This also un-caps the UDP transport, which was silently pinned toinfo.- File logging is opt-in. Without
APP_ENV_LOGGER_FOLDER_PATH, no rotating file transports are created. Before, the folder defaulted to./and every process scattered*-info-*.logfiles into its working directory. - Custom-logger caching fixed.
Logger.get(scope, customLogger)cached underscope:custom, so a second, different Winston instance for the same scope got the first one's wrapper, and.for(method)fell back to the defaultapplicationLogger. A custom-backed logger is now a fresh wrapper per call and.for()keeps its backing instance. DgramTransportcannot crash the process. A failed UDPsendused to raise an unhandled error. It now logs the failure and drops the socket so the next line reconnects.
Who is affected
- Apps using
LoggerFactory.getLoggerorthis.logger.for(...). No action needed. - Deployments relying on default
./file logs withoutAPP_ENV_LOGGER_FOLDER_PATH. File logs stop until you set the variable. Console output is unchanged, so stdout collection (Docker, Kubernetes) is unaffected. - Log aggregators parsing text files. Lines no longer carry ANSI escapes, so strip-ANSI workarounds can go.
Details
- The
textconsole line shape is unchanged:<timestamp> [<label>] <level>: <message>. - New
ICustomLoggerOptionsfields:format?: 'json' | 'text'andlevel?: TLogLevel, defaulting to the env variables. PassingloggerFormatterstill overrides everything. - New exports:
resolveLoggerLevel({ configured })(validates againstLogLevels, falls back todebugwith a console warning) andresolveDefaultTransportOptions(). definePrettyLoggerFormattergainedcolorize?: boolean(defaulttrue).