Exclude internetarchive's internal logging from Discord #346
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.
Problem
After #345, the archive.org-related Discord log spam is reduced to one of these every 5 minutes:
Cause
The Mirrorer is (appropriately) checking whether archive.org is overloaded here, which returns
True
:NetKAN-Infra/netkan/netkan/mirrorer.py
Line 292 in 9831903
We don't log that message;
internetarchive
itself does, specifically here:https://github.com/jjjake/internetarchive/blob/c578552d0c532f513b6e972b9f5529584b04c254/internetarchive/session.py#L539
This shouldn't be forwarded to Discord.
Changes
Now
DiscordLogHandler
's constructor accepts a regex to evaluate against each log record's logger name, which we pass as a zero-width negative lookahead assertion to exclude loggers containinginternetarchive
.