Index: xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp =================================================================== --- xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp (revision 15666) +++ xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp (working copy) @@ -115,7 +115,22 @@ Py_INCREF(Py_None); return Py_None; } + + // getLogPath() method + PyDoc_STRVAR(getLogPath__doc__, + "getLogPath() -- Retrieve the file that XBMC is logging to.\n" + "\n" + "example:\n" + " - logPath = xbmc.getLogPath()\n"); + PyObject* XBMC_GetLogPath(PyObject *self, PyObject *args) + { + CStdString strLogPath = CLog::GetLogPath(); + if (strLogPath.IsEmpty()) + return NULL; + return PyString_FromString(strLogPath.c_str()); + } + // shutdown() method PyDoc_STRVAR(shutdown__doc__, "shutdown() -- Shutdown the xbox.\n" @@ -753,6 +768,7 @@ PyMethodDef xbmcMethods[] = { {(char*)"output", (PyCFunction)XBMC_Output, METH_VARARGS, output__doc__}, {(char*)"log", (PyCFunction)XBMC_Log, METH_VARARGS, log__doc__}, + {(char*)"getLogPath", (PyCFunction)XBMC_GetLogPath, METH_VARARGS, getLogPath__doc__}, {(char*)"executescript", (PyCFunction)XBMC_ExecuteScript, METH_VARARGS, executeScript__doc__}, {(char*)"executebuiltin", (PyCFunction)XBMC_ExecuteBuiltIn, METH_VARARGS, executeBuiltIn__doc__}, Index: xbmc/utils/log.cpp =================================================================== --- xbmc/utils/log.cpp (revision 15666) +++ xbmc/utils/log.cpp (working copy) @@ -31,6 +31,7 @@ #include "Util.h" FILE* CLog::fd = NULL; +char CLog::logPath[PATH_MAX] = ""; static CCriticalSection critSec; @@ -83,6 +84,8 @@ #else fd = fopen(strLogFile, "a+"); #endif + if (fd) + strncpy(logPath, strLogFile.c_str(), PATH_MAX); } if (!fd) @@ -184,6 +187,11 @@ OutputDebugString(strData.c_str()); } +char* CLog::GetLogPath() +{ + return logPath; +} + void CLog::MemDump(BYTE *pData, int length) { Log(LOGDEBUG, "MEM_DUMP: Dumping from %p", pData); Index: xbmc/utils/log.h =================================================================== --- xbmc/utils/log.h (revision 15666) +++ xbmc/utils/log.h (working copy) @@ -23,6 +23,12 @@ #include +#ifndef _LINUX +#define PATH_MAX MAX_PATH +#else +#include +#endif + #define LOG_LEVEL_NONE -1 // nothing at all is logged #define LOG_LEVEL_NORMAL 0 // shows notice, error, severe and fatal #define LOG_LEVEL_DEBUG 1 // shows all @@ -49,6 +55,7 @@ class CLog { static FILE* fd; + static char logPath[PATH_MAX]; public: CLog(); virtual ~CLog(void); @@ -57,6 +64,7 @@ static void DebugLog(const char *format, ...); static void MemDump(BYTE *pData, int length); static void DebugLogMemory(); + static char* GetLogPath(); }; // GL Error checking macro