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

Allow user to disable LOG_FILE handler #14

Closed

Conversation

vitorbaptista
Copy link

As we already set the LOG_FILE configuration variable by default, there was no
way for the user to disable having a log file. Even if she tried to do

LOG_FILE = None

It won't work, because logging.handlers.RotatingFileHandler() throws an error
when called with None. Even if it worked, we still added this handler a few
lines down, because we were checking if there was a LOG_FILE key in the config
file (which is always true, given that we set it by default and there's no way
IMHO to delete it)

With this patch, we only create the file handler if there is a
RotatingFileHandler, and it's trueish.

As we already set the LOG_FILE configuration variable by default, there was no
way for the user to disable having a log file. Even if she tried to do

    LOG_FILE = None

It won't work, because logging.handlers.RotatingFileHandler() throws an error
when called with None. Even if it worked, we still added this handler a few
lines down, because we were checking if there was a LOG_FILE key in the config
file (which is always true, given that we set it by default and there's no way
IMHO to delete it)

With this patch, we only create the file handler if there is a
RotatingFileHandler, and it's trueish.
@vitorbaptista
Copy link
Author

AFAIK, the only way to "disable" the LOG_FILE right now is to set it to LOG_FILE = /dev/null.

@amercader
Copy link
Member

Done in #56

@amercader amercader closed this Apr 13, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants