def decorate_logger_methods(logger):
    """
    Decorate all the logger methods so all the keys in the extra dictionary are
    automatically prefixed with an underscore to avoid clashes with standard log
    record attributes.
    """

    # Note: We override findCaller with our custom implementation which takes into account this
    # module.
    # This way filename, module, funcName and lineno LogRecord attributes contain correct values
    # instead of all pointing to decorate_log_method.
    logger.findCaller = find_caller
    for key in LOGGER_KEYS:
        log_method = getattr(logger, key)
        log_method = decorate_log_method(log_method)
        setattr(logger, key, log_method)

    return logger

    Decorate all the logger methods so all the keys in the extra dictionary are
    automatically prefixed with an underscore to avoid clashes with standard log
    record attributes.
    
st2common/st2common/log.py