st2common/st2common/log.py
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'):
            co = f.f_code
            filename = os.path.normcase(co.co_filename)
            if filename in (_srcfile, logging._srcfile):  # This line is modified.
                f = f.f_back
                continue
            rv = (filename, f.f_lineno, co.co_name)
            break
    except Exception:
        pass

    return rv

    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
    
Find the stack frame of the caller so that we can note the source file name, line number and
function name.


Find the stack frame of the caller so that we can note the source file name line number and function name .
def find_caller():
    rv = '(unknown file)', 0, '(unknown function)'
    try:
        f = logging.currentframe().f_back
        while hasattr(f, 'f_code'):
            co = f.f_code
            filename = os.path.normcase(co.co_filename)
            if filename in (_srcfile, logging._srcfile):  
                f = f.f_back
                continue
            rv = (filename, f.f_lineno, co.co_name)
            break
    except Exception:
        pass
    return rv
def find_caller ( ) : rv = '(unknown file)' , 0 , '(unknown function)' try : f = logging . currentframe ( ) . f_back while hasattr ( f , 'f_code' ) : co = f . f_code filename = os . path . normcase ( co . co_filename ) if filename in ( _srcfile , logging . _srcfile ) : f = f . f_back continue rv = ( filename , f . f_lineno , co . co_name ) break except Exception : pass return rv
Find the stack frame of the caller so that we can note the source file name, line number and
function name.
Find the stack frame of the caller so that we can note the source file name line number and function name .
"""
    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
    """ # This line is modified.