-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Ability to filter log messages by regular expression #2893
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your participation and understanding. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your participation and understanding. |
While I can see the potential value in filtering logs via regular expressions, I'm not quite sure how many folks would actually use such a feature. Anyone out there want this feature enough to be willing to work on implementing it? |
I actually just ran into a desire to have this as well. I've added https://pypi.org/project/pelican-advthumbnailer/ to my site and it is spouting a lot of warnings that can be safely ignored, but since they include full filesystem paths, the exact message depends on where the site content lives. |
Hi Koen. Thanks for offering to assist with this feature. Rather than adding a new setting, perhaps the existing setting could be extended to include the filter type, defaulting to LOG_FILTER = [
("string", logging.WARN, "TAG_SAVE_AS is set to False"),
("regex", logging.WARN, 'r"^TAG_SAVE_AS'),
]
What do you think? |
Hi @justinmayer , |
That is indeed what I intended. 😊 |
@justinmayer I've created an MR, but it's waiting for maintainer approval before the ci can run. If you have a moment, perhaps you can approve? https://github.com/getpelican/pelican/actions/runs/4403482780 |
@sonologic: I posted a comment to that PR. Let's move this discussion there. |
Sorry if this is the wrong place to put this, but rather than change the length of the tuple in LOG_FILTERs values, So converting the example above:
This would prevent old settings from breaking in new versions of Pelican. |
@copperchin Do you mean we expect users to provide compiled regular expressions? And handle it internally with an Also, changing |
It seems reasonable to assume that if :
... then they know they need to mark the regex as such. I don't think using It also has the added benefit of being immediately identifiable as regex in any syntax highlighter 👍
This is only true in one direction. Keeping the 2-tuple format means configs will only break older versions of Furthermore, keeping the 2-tuple means updating to a newer version of ... On the other hand, changing the config format to 3-tuples requires rewriting the configs, which will immediately break on older versions |
I didn't mean it as a hurdle. Knowing what should be done and actually remembering to do it are different things :).
No, with the way I described, it will still work but you'll get a pesky warning about it. And in my experience, people don't stick with a version long enough to port everything over before doing a roll back. They usually hit some deal breaker pretty early (immediately?). So, compatibility in the other direction is less of a concern mostly. Anyway, I don't have a strong preference in either option :). In technical terms, we can make both work. |
Feature Request
Pelican has a
LOG_FILTER
setting that allows warnings and other logging messages to be suppressed based on the exact text of the message, or on a fixed template. Instead of (or in addition to) filtering by fixed templates, it would be nice if messages could be filtered by regular expression. Among other things, this would provide a better fix for Issue #2398 by allowing warning messages to be filtered on a per-image or per-page basis.The text was updated successfully, but these errors were encountered: