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

Deno's logger's formatter method doesn't allow not logging a string #27709

Open
johndeighan opened this issue Jan 17, 2025 · 1 comment
Open

Comments

@johndeighan
Copy link

In my logger config, I have 2 handlers, 'console' and 'file'. Each has its own custom formatter. Then I have a logger named 'debug' that invokes both of these handlers. What I want is to invoke the 'debug' logger with the name of the current main module when it's different than it was when the previous log was output. That way, when I look at the log file, I'll know when the main module was changed (e.g. when Deno.Output was used to execute an external script).

However, I don't want that information to appear in the console. I expected that if my console formatter returned undefined or null, it would prevent output to the console entirely. Unfortunately, it outputs either the string 'undefined' or 'null' instead. I can, in fact, return '' but then a newline still gets output to the console.

This feature request is to find some way to prevent output entirely in a custom formatter.

@bartlomieju
Copy link
Member

bartlomieju commented Jan 17, 2025

Is this problem related to https://jsr.io/@std/log? Can you provide some reproduction code?

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

2 participants