(default_logger=None)
return DEFAULT_FALLBACK_LOGGER
Search the current AgentCheck log starting from closest stack frame.

    Caveat: Frame lookup has a cost so the recommended usage is to retrieve and store the logger once
    and avoid calling this method on every check run.
Search the current AgentCheck log starting from closest stack frame.
Search the current AgentCheck log starting from closest stack frame .
def get_check_logger(default_logger=None):
    """
    Search the current AgentCheck log starting from closest stack frame.

    Caveat: Frame lookup has a cost so the recommended usage is to retrieve and store the logger once
    and avoid calling this method on every check run.
    """
    from datadog_checks.base import AgentCheck

    for i in range(LOGGER_FRAME_SEARCH_MAX_DEPTH):
        try:
            frame = sys._getframe(i)
        except ValueError:
            break
        if 'self' in frame.f_locals:
            check = frame.f_locals['self']
            if isinstance(check, AgentCheck):
                return check.log
    if default_logger is not None:
        return default_logger
    return DEFAULT_FALLBACK_LOGGER
def get_check_logger ( default_logger = None ) : from datadog_checks . base import AgentCheck for i in range ( LOGGER_FRAME_SEARCH_MAX_DEPTH ) : try : frame = sys . _getframe ( i ) except ValueError : break if 'self' in frame . f_locals : check = frame . f_locals [ 'self' ] if isinstance ( check , AgentCheck ) : return check . log if default_logger is not None : return default_logger return DEFAULT_FALLBACK_LOGGER