-
Notifications
You must be signed in to change notification settings - Fork 87
Obey the configured levels when posting from logging
#192
Conversation
🤖 zincr found 0 problems , 0 warnings
|
kopf/engines/logging.py
Outdated
@@ -39,9 +40,10 @@ def createLock(self): | |||
def filter(self, record): | |||
# Only those which have a k8s object referred (see: `ObjectLogger`). | |||
# Otherwise, we have nothing to post, and nothing to do. | |||
fit_lvl = record.levelno >= config.EventsConfig.events_loglevel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe filter_level instead? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Fits the minimal level condition". Some help with proper wording is appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loglevel_higher? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samurang87 Fixed (probably).
Fix an issue with k8s-events posted for log messages despite the configured levels.
Description
Configured log levels was ignored in the connector of the
logging
facilities to the k8s-event posting engine, so all events were posted. The docs were written for the event-posting shortcuts, but this was not taken into account when the log-posting engine was added.In addition, some extra checks are added to verify that the shortcuts actually obey the configured levels.
Note that the debug level messages are now filtered not by the K8s-posting handler
K8sPoster
— the minimum level is removed from there— but by itsfilter()
method, based on the Kopf's configs. Which is generally equivalent, as it was previously filtered by level insuper().filter(record)
, which stands in the same line.Types of Changes
Review
List of tasks the reviewer must do to review the PR