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

stdout/stderr based on log level #69

Closed
fireflycons opened this issue May 1, 2024 · 4 comments
Closed

stdout/stderr based on log level #69

fireflycons opened this issue May 1, 2024 · 4 comments

Comments

@fireflycons
Copy link
Contributor

Hi @phuslu

Here's another suggestion 😁

Some log forwarders like filebeat can switch on the stream on which logs are emitted. It would be nice if for the standard logger type we could select the output stream based on the log level, e.g. severity of warning or higher goes to stderr and lower levels go to stdout. User can set at which level the change from stdout to stderr happens.

@phuslu
Copy link
Owner

phuslu commented May 1, 2024

looks like multiple-dispatching-writer does
https://github.com/phuslu/log?tab=readme-ov-file#multiple-dispatching-writer

let me check it can meet the requirement or we could enhance the writer.

@phuslu
Copy link
Owner

phuslu commented May 1, 2024

After consideration, I think it's no needed to introduce a new Writer but worth to add a helper/type function to make it easier.

So I add a commit df27c52

@fireflycons could you please take a look the example here https://github.com/phuslu/log?tab=readme-ov-file#customize-the-log-writer ? If OK, I'd like release a new tag.

@fireflycons
Copy link
Contributor Author

Nice - go for it!

@phuslu
Copy link
Owner

phuslu commented May 1, 2024

v1.0.93 tagged/released, thanks

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