Skip to main content

logger_isa

Determines if a logger is an instance of or a descendant of a specific parent logger by traversing the logger hierarchy. It raises a RuntimeError if a circular reference is detected or if the hierarchy depth exceeds the specified maximum.

def logger_isa(
l: logging.Logger,
p: logging.Logger,
max: int = 1000
) - > boolean

Checks if a logger is a descendant of a specific parent logger by traversing the hierarchy upwards.

Parameters

NameTypeDescription
llogging.LoggerThe child logger instance to start the search from.
plogging.LoggerThe potential ancestor logger instance to check against.
maxint = 1000The maximum depth to traverse before raising a RuntimeError to prevent infinite loops.

Returns

TypeDescription
booleanTrue if the parent logger is found in the hierarchy, False if the root is reached without a match.