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

Add Additional Primary Writer #32

Closed
raytiley opened this issue Jul 23, 2019 · 5 comments
Closed

Add Additional Primary Writer #32

raytiley opened this issue Jul 23, 2019 · 5 comments

Comments

@raytiley
Copy link

I might be missing something but it seems like the add_writer requires calling all the logging macros with a target. I can't see any way to add an additional writer that always get's used.

Would adding some way to add writers that always get logged to be accepted?

My use case is I want to write a custom writer for the windows event viewer but also use the file log writer to keep text logs for my application.

Thanks!

@emabee
Copy link
Owner

emabee commented Jul 23, 2019

The additional writers are special in two regards:

  • they need to be addressed explicitly in the log macros with the target name for which they are registered
  • if addressed that way, they are always called, independent of the current log specification

Or put the other way: the log specification only influences the default logger.

How would you want it for your "sibling of the default writer" - filtered by the log specification, or always called?
In the latter case, your implementation could still have its own filtering mechanism, but this additional flexibility would come with increased overall complexity.

@emabee
Copy link
Owner

emabee commented Aug 8, 2019

I provided an implementation in branch add_default_writer.
Would be great if you could test it and give feedback!

@fin-ger
Copy link

fin-ger commented Aug 22, 2019

I think the additional default writer should inherit the log specification from the default writer. I think this is the expected behavior by users.

@fin-ger
Copy link

fin-ger commented Aug 22, 2019

@emabee I tested the add_default_writer branch and it worked like a charm!

@emabee
Copy link
Owner

emabee commented Aug 22, 2019

Great, thanks! I just published 0.14.3 with the change from add_default_writer.

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

No branches or pull requests

3 participants