Add Log method "any handler is minimum level" with tests

Checks if a given handler is set for any current active handler
This commit is contained in:
Clemens Schwaighofer
2025-12-04 14:37:55 +09:00
parent 895701da59
commit acd61e825e
3 changed files with 107 additions and 0 deletions

View File

@@ -392,6 +392,24 @@ class LogParent:
except IndexError:
return LoggingLevel.NOTSET
def any_handler_is_minimum_level(self, log_level: LoggingLevel) -> bool:
"""
if any handler is set to minimum level
Arguments:
log_level {LoggingLevel} -- _description_
Returns:
bool -- _description_
"""
for handler in self.handlers.values():
try:
if LoggingLevel.from_any(handler.level).includes(log_level):
return True
except (IndexError, AttributeError):
continue
return False
@staticmethod
def validate_log_level(log_level: Any) -> bool:
"""