26 #ifndef PY_TRACE_LOG_H
27 #define PY_TRACE_LOG_H
33 # define TRED FOREGROUND_RED | FOREGROUND_INTENSITY
34 # define TGREEN FOREGROUND_GREEN | FOREGROUND_INTENSITY
35 # define TYELLOW FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY
36 # define TNORMAL FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE
37 # define TWHITE TNORMAL | FOREGROUND_INTENSITY
38 # define TBLUE FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY
49 #ifndef HAVE_WINDOWS_H
85 PyTraceLog(
const char *path,
bool toConsole =
false,
bool toFile =
false)
97 mFout = fopen(path,
"w+");
99 printf(
"[error]PyTraceLog: sorry initializing the output file failed\n");
102 #ifdef HAVE_WINDOWS_H
106 mStderrHandle = GetStdHandle(STD_ERROR_HANDLE);
107 mStdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
204 fprintf(stdout,
"%s\n", msg.
content().c_str());
280 fprintf(stdout,
"[PyTrace] ");
281 vfprintf(stdout, str, ap);
287 fprintf(
mFout,
"[PyTrace] ");
288 vfprintf(
mFout, str, ap);
305 #ifdef HAVE_WINDOWS_H
306 SetConsoleTextAttribute(mStdoutHandle,
TNORMAL);
318 #ifdef HAVE_WINDOWS_H
319 HANDLE mStdoutHandle, mStderrHandle;
323 #endif//PY_TRACE_LOG_H
a python client stack trace logger for Evemu
void _logInternMessage(const char *str,...)
intern function for handling logger related messages
void _logInternBufferPacket(PyRep *packet)
void _logInternStringMessage(PyRep *packet)
PyRep * GetItem(size_t index) const
Returns Python object.
const Buffer & content() const
Get the const PyBuffer content.
void _logInternBufferMessage(PyRep *packet)
static const char * colorstrings[TBLUE+1]
size_t size() const
Obtains length of the buffer.
PyTraceLog(const char *path, bool toConsole=false, bool toFile=false)
The constructor of the python stack trace logger.
bool logTrace(PyTuple &tuple)
logTrace is the function what its all about.
const std::string & content() const
Get the PyString content.
~PyTraceLog()
the destructor.... nothing special
void _setLogColor(uint32 color)
Internal function to set the console output color.