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

A few minor logging enhancements #195

Merged
merged 2 commits into from
Apr 6, 2021
Merged

A few minor logging enhancements #195

merged 2 commits into from
Apr 6, 2021

Conversation

attzonko
Copy link
Owner

@attzonko attzonko commented Apr 5, 2021

Adds a bit clearer logging and the ability to also log to a file if the LOG_FILE setting is set.

@attzonko attzonko requested a review from jneeven April 5, 2021 21:41
Copy link
Collaborator

@jneeven jneeven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Comment on lines 31 to 39
logging.basicConfig(
**{
"format": "[%(asctime)s] %(message)s",
"format": self.settings.LOG_FORMAT,
"datefmt": "%m/%d/%Y %H:%M:%S",
"level": logging.DEBUG if self.settings.DEBUG else logging.INFO,
"stream": sys.stdout,
"filename": self.settings.LOG_FILE,
"filemode": "w",
}
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the format be used globally? Or only for the logger in this file?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation is that the LOG_FORMAT from settings is used for both the console login to stdout and the log file. However, if you think we should provide independent FORMAT settings for each I am fine with that. My goal was to provide some flexibility while still having a sane default.

@attzonko attzonko merged commit 3408547 into master Apr 6, 2021
@jneeven jneeven deleted the logging_enhancments branch April 7, 2021 07:28
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.

2 participants