Introduce new handlers and refactor filters#37
Conversation
5a05edb to
4a16756
Compare
21222c2 to
f1d4953
Compare
f1d4953 to
a6ec6c9
Compare
| add_ers_kafka_handler(logger, use_parent_handlers, "session_tester") | ||
|
|
||
| if throttle: | ||
| # Note: Default parameters used. No functionality on customisability yet |
There was a problem hiding this comment.
Discuss if we want to make it customizable here
There was a problem hiding this comment.
After discussion, it is decided to leave as is for now. Can discuss with Marco later on to get his opinion though
| from daqpytools.logging.levels import level_to_ers_var, logging_log_level_to_str | ||
| from daqpytools.logging.utils import get_width | ||
|
|
||
| class FormattedRichHandler(RichHandler): |
There was a problem hiding this comment.
This is moved from the bottom of the file to up here so I can initialise the daqpytools logger
| @@ -58,13 +160,17 @@ class HandlerType(Enum): | |||
| File = "file" | |||
| Protobufstream = "protobufstream" | |||
| Lstdout = "lstdout" | |||
There was a problem hiding this comment.
I should note that while Lstdout is defined, I have not defined Lstderr just yet as it isnt used in any of the OKS configs as far as I can see.
Should be easy enough to implement. Do you want me to?
|
Hi @PawelPlesniak, in the interest of timing and availability I'll ask for your review today before I leave. The overall functionality exists and works as expected. Theres a few minor improvements here and there that I've commented about, but they shouldn't affect the functionality. Theres also a couple where I ask for input. But yeah, wouldbe great if you can take a look at the code already + the functionality, and lmk what you think |
Description
Fixes #36
This PR Introduces a couple of changes that fixes #36
Added Throttling Filter (and demonstration)
get_daq_logger, it uses a boolean and so the 30s and 30msg can't be changed. This is fine for now but should be easy to make more customisable later.Added support for Lstdout
stdout_handler.addFilter(HandleIDFilter([HandlerType.Stream, HandlerType.Lstdout])).Improves Filtering class logic and inheritance
BaseHandlerFilterclass which contains a lot of the checks on when to emit a message or not.Move away from string based log level matching to enum-based log level matching
level_to_ers_var.get(record.levelname)), which would now contain erroneous whitespace and matching would failImproves logging of the logging framework
"erstrace,throttle,lstdout"TODO
Type of change
Testing checklist
dbt-build --unittest)pytest -s minimal_system_quick_test.py)daqsystemtest_integtest_bundle.sh)python -m pytest)pre-commit run --all-files)How to test the changes
daqpytools-logging-demonstrator -rdaqpytools-logging-demonstrator -r --throttledaqpytools-logging-demonstrator -s --handlertypesFurther checks
dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)(Indicate issue here: # (issue))