def findCaller(self, stack_info=False, callers=0):
        """
        Find the stack frame of the caller so that we can note the source
        file name, line number and function name. Not only ignore this class's
        and logger's source, but also as many callers as requested.
        """
        f = logging.currentframe()
        #On some versions of IronPython, currentframe() returns None if
        #IronPython isn't run with -X:Frames.
        if f is not None:
            if callers > 0:
                # yes we can!
                co = f.f_code
                logger.debug2("%s:%s", co.co_filename, co.co_name)
            f = f.f_back
        rv = "(unknown file)", 0, "(unknown function)", None
        countdown = callers
        while hasattr(f, "f_code"):
            co = f.f_code
            filename = os.path.normcase(co.co_filename)
            if callers > 0:
                # yes we can!
                logger.debug2("%s:%s", co.co_filename, co.co_name)
            if filename in(_srcfile, logging._srcfile):
                f = f.f_back
                continue
            if countdown > 0:
                f = f.f_back
                countdown -= 1
                continue
            sinfo = None
            if stack_info:
                sio = io.StringIO()
                sio.write('Stack (most recent call last):\n')
                traceback.print_stack(f, file=sio)
                sinfo = sio.getvalue()
                if sinfo[-1] == '\n':
                    sinfo = sinfo[:-1]
                sio.close()
            rv = (co.co_filename, f.f_lineno, co.co_name, sinfo)
            break
        return rv
def findCaller ( self , stack_info = False , callers = 0 ) : f = logging . currentframe ( ) if f is not None : if callers > 0 : co = f . f_code logger . debug2 ( "%s:%s" , co . co_filename , co . co_name ) f = f . f_back rv = "(unknown file)" , 0 , "(unknown function)" , None countdown = callers while hasattr ( f , "f_code" ) : co = f . f_code filename = os . path . normcase ( co . co_filename ) if callers > 0 : logger . debug2 ( "%s:%s" , co . co_filename , co . co_name ) if filename in ( _srcfile , logging . _srcfile ) : f = f . f_back continue if countdown > 0 : f = f . f_back countdown -= 1 continue sinfo = None if stack_info : sio = io . StringIO ( ) sio . write ( 'Stack (most recent call last):\n' ) traceback . print_stack ( f , file = sio ) sinfo = sio . getvalue ( ) if sinfo [ - 1 ] == '\n' : sinfo = sinfo [ : - 1 ] sio . close ( ) rv = ( co . co_filename , f . f_lineno , co . co_name , sinfo ) break return rv
Find the stack frame of the caller so that we can note the source
        file name, line number and function name. Not only ignore this class's
        and logger's source, but also as many callers as requested.