func = inspect.currentframe().f_back.f_code
logging.debug('%s: %s in %s:%i' % (message, func.co_name, func.co_filename,
    func.co_firstlineno))
Python Logging (function name, file name, line number) using a single file