()
Initialize logging (set up forwarding to Go backend and sane defaults)
Initialize logging (set up forwarding to Go backend and sane defaults)
Initialize logging ( set up forwarding to Go backend and sane defaults )
def init_logging():
    # type: () -> None
    """
    Initialize logging (set up forwarding to Go backend and sane defaults)
    """
    # Forward to Go backend
    logging.addLevelName(TRACE_LEVEL, 'TRACE')
    logging.setLoggerClass(AgentLogger)
    logging.captureWarnings(True)  # Capture warnings as logs so it's easier for log parsers to handle them.

    rootLogger = logging.getLogger()
    rootLogger.addHandler(AgentLogHandler())
    rootLogger.setLevel(_get_py_loglevel(datadog_agent.get_config('log_level')))

    # We log instead of emit warnings for unintentionally insecure HTTPS requests
    warnings.simplefilter('ignore', InsecureRequestWarning)

    # `requests` (used in a lot of checks) imports `urllib3`, which logs a bunch of stuff at the info level
    # Therefore, pre emptively increase the default level of that logger to `WARN`
    urllib_logger = logging.getLogger("requests.packages.urllib3")
    urllib_logger.setLevel(logging.WARN)
    urllib_logger.propagate = True
def init_logging ( ) : # type: () -> None # Forward to Go backend logging . addLevelName ( TRACE_LEVEL , 'TRACE' ) logging . setLoggerClass ( AgentLogger ) logging . captureWarnings ( True ) # Capture warnings as logs so it's easier for log parsers to handle them. rootLogger = logging . getLogger ( ) rootLogger . addHandler ( AgentLogHandler ( ) ) rootLogger . setLevel ( _get_py_loglevel ( datadog_agent . get_config ( 'log_level' ) ) ) # We log instead of emit warnings for unintentionally insecure HTTPS requests warnings . simplefilter ( 'ignore' , InsecureRequestWarning ) # `requests` (used in a lot of checks) imports `urllib3`, which logs a bunch of stuff at the info level # Therefore, pre emptively increase the default level of that logger to `WARN` urllib_logger = logging . getLogger ( "requests.packages.urllib3" ) urllib_logger . setLevel ( logging . WARN ) urllib_logger . propagate = True