In C++, I can print debug output like this:
printf( \"FILE: %s, FUNC: %s, LINE: %d, LOG: %s\\n\", __FILE__, __FUNCTION__, __LINE__, logmessage
For example
import inspect frame = inspect.currentframe() # __FILE__ fileName = frame.f_code.co_filename # __LINE__ fileNo = frame.f_lineno
There's more here http://docs.python.org/library/inspect.html