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 .