-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Trouble understanding the level property on loggers #26
Comments
No, you're not wrong in your understanding. It appears to be a bug in LogTape, which I'll get fixed soon. |
One workaround you can use right now is to use sink filters. |
Upon further reflection, I don't think it's a bug, but I realized that the current configuration syntax is easy to misunderstand. I'll try to fix the configuration syntax in the next version. |
Thanks for looking into it. I will check out sink filters. Again I might be misunderstanding, but this section of the docs: https://logtape.org/manual/levels#configuring-severity-levels Has an example that seems to imply the behaviour outlined in my first comment would be correct: await configure({
// ... other configuration ...
loggers: [
{
category: ["app"],
level: "info", // This will log info and above
},
{
category: ["app", "database"],
level: "debug", // This will log everything for database operations
}
]
}); It is only a small section though, but the comments do seem to imply that the baseline logger won't log debug logs. If that is not the case, it might be worth reviewing or removing this section of the docs. |
That section is incorrectly described, I'll fix it… 😓 |
Thanks for your help! Filters work great, and otherwise I really enjoy the API so far |
Since LogTape 0.8.0, the |
With the above setup, I would expect that a logger created using
getLogger(["hono", "db", "some-module"]
to log INFO and above to both jsonl and db sinks, but any DEBUG logs to only be sent to the db sink.In reality, all logs are sent to both sinks.
This is the same for a logger with category ["hono", "console", "something"]; I wouldn't expect debug logs to be sent to jsonl, but they are.
Using
parentSink: override
works as expected: all levels of logs are sent to the correct sink, nothing is sent to jsonl.Can you help me understand how I can set this up correctly?
The text was updated successfully, but these errors were encountered: