Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport Log Level should be a CAP not Overwrite the Loggers Level #203

Open
martin-hartmond-mw opened this issue Jan 9, 2024 · 0 comments

Comments

@martin-hartmond-mw
Copy link

// Remark: This has to be handled in the base transport now because we
// cannot conditionally write to our pipe targets as stream. We always
// prefer any explicit level set on the Transport itself falling back to
// any level set on the parent.
const level = this.level || (this.parent && this.parent.level);

This always overwrites the Logger Level.
The transports level should behave like a cap, so that the Developer can use the transport options to set global caps (e.g. don't log anything below WARN to the log server) while configuring context-specific levels in the loggers.

E.g.

transports: [
    FileTransport(level: VERBOSE),
    HttpTransport(level: WARN)
]
loggers: [
    Logger('application', level: INFO),
    Logger('redis', level: WARN),
    Logger('pgsql', level: VERBOSE),
]

I would expect SQL logs of 'psql' to show up only in the File Logs, and Redis debug messages to not show up at all. I would expect application info messages to show up in the File Logs only.

Related issue: the applicationinsights instrumentation of winston initializes the applicationinsights transport with 'silly', since it wants to log anything that the loggers deem log-worthy. This causes all debug logs to be transported into applicationinsights, no matter how the level on the specific logger is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant