Beispiel #1
0
]

# NOTE: We set AUDIT to the highest log level which means AUDIT log messages will always be
# included (e.g. also if log level is set to INFO). To avoid that, we need to explicitly filter
# out AUDIT log level in service setup code.
logging.AUDIT = logging.CRITICAL + 10
logging.addLevelName(logging.AUDIT, 'AUDIT')

LOGGER_KEYS = [
    'debug', 'info', 'warning', 'error', 'critical', 'exception', 'log',
    'audit'
]

# Note: This attribute is used by "find_caller" so it can correctly exclude this file when looking
# for the logger method caller frame.
_srcfile = get_normalized_file_path(__file__)


def find_caller(*args, **kwargs):
    """
    Find the stack frame of the caller so that we can note the source file name, line number and
    function name.

    Note: This is based on logging/__init__.py:findCaller and modified so it takes into account
    this file - https://hg.python.org/cpython/file/2.7/Lib/logging/__init__.py#l1233
    """
    rv = '(unknown file)', 0, '(unknown function)'

    try:
        f = logging.currentframe().f_back
        while hasattr(f, 'f_code'):
Beispiel #2
0
LOGGER_KEYS = [
    'debug',
    'info',
    'warning',
    'error',
    'critical',
    'exception',
    'log',

    'audit'
]

# Note: This attribute is used by "find_caller" so it can correctly exclude this file when looking
# for the logger method caller frame.
_srcfile = get_normalized_file_path(__file__)


def find_caller():
    """
    Find the stack frame of the caller so that we can note the source file name, line number and
    function name.

    Note: This is based on logging/__init__.py:findCaller and modified so it takes into account
    this file - https://hg.python.org/cpython/file/2.7/Lib/logging/__init__.py#l1233
    """
    rv = '(unknown file)', 0, '(unknown function)'

    try:
        f = logging.currentframe().f_back
        while hasattr(f, 'f_code'):