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:
@@ -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:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user