logging: add logging mechanism, hooks to log uncaught crashes, and an example use of the logging tools #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds logging tools in the squid.logging module (along with the squid package), and two helpers there for getting loggers and setting the squid logger logging level. This allows us to have a dedicated hierarchy of loggers that we can configure while leaving all the loggers setup by other libraries alone.
It also adds an example usage in the control._def.py module. We can start converting individual files after this.
It also lays the groundwork for better crash reports by allowing us to hook up handlers for uncaught exceptions. By default these just print to console, but we want to be able to hook up a FileHandler to our logger and have the uncaught exceptions go there as well. Actually creating the FileHandler and attaching it to the root squid logger is to come.
NOTE: This was originally hongquanli#114 but has been moved here since this is going to be the main development repository moving forward.
Tested by:
python -m pytest.