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

FileLogger add level argument to match SimpleLogger #82

Open
sjdaines opened this issue Jul 30, 2023 · 1 comment
Open

FileLogger add level argument to match SimpleLogger #82

sjdaines opened this issue Jul 30, 2023 · 1 comment

Comments

@sjdaines
Copy link

sjdaines commented Jul 30, 2023

With Logging.SimpleLogger you can do

SimpleLogger(logstream, Logging.Info)

It would be convenient if LoggingExtras.FileLogger allowed level to be set in the same way so it works as a drop-in replacement, ie

FileLogger(logstream, Logging.Info)
FileLogger("my_logfile.txt", Logging.Info)

edit: perhaps this is just a documentation request, the equivalent is (?):

LoggingExtras.MinLevelLogger(
    LoggingExtras.FileLogger(logstream, always_flush=true),
    Logging.Info
)
@oxinabox
Copy link
Member

oxinabox commented Aug 8, 2023

This is indeed exactly equivalent to wrapping in a MinLevelLogger, and that is the preferred way to do this.
Feel free to open a documentation PR, that would make a decent example to add under the MinLevelLogger

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