From f5f7c53a40a6fe706de7abf64e5d0a4dcd6c48d4 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 21 Jun 2010 20:24:02 +0200 Subject: [PATCH] Fixed: #990 Add possibility to set and get log directory --- code/nel/include/nel/misc/debug.h | 3 +++ code/nel/src/misc/debug.cpp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/code/nel/include/nel/misc/debug.h b/code/nel/include/nel/misc/debug.h index 8a7626fbd..673159485 100644 --- a/code/nel/include/nel/misc/debug.h +++ b/code/nel/include/nel/misc/debug.h @@ -89,6 +89,9 @@ void destroyDebug(); // call this if you want to change the dir of the log.log file void changeLogDirectory(const std::string &dir); +// call this if you want to get the dir of the log.log file +std::string getLogDirectory(); + // internal breakpoint window void enterBreakpoint (const char *message); diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index d406aef89..1423692a1 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -93,6 +93,7 @@ namespace NLMISC bool DisableNLDebug= false; NLMISC::CVariablePtr _DisableNLDebug("nel","DisableNLDebug","Disables generation and output of nldebug logs (no code associated with the log generation is executed)",&DisableNLDebug,true); +static std::string LogPath = ""; //bool DebugNeedAssert = false; //bool NoAssert = false; @@ -1116,10 +1117,16 @@ void getCallStackAndLog (string &result, sint /* skipNFirst */) void changeLogDirectory(const std::string &dir) { if (fd == NULL)return; - string p = CPath::standardizePath(dir) + "log.log"; + LogPath = CPath::standardizePath(dir); + string p = LogPath + "log.log"; fd->setParam(p); } +std::string getLogDirectory() +{ + return LogPath; +} + // You should not call this, unless you know what you're trying to do (it kills debug/log)! // Destroys debug environment, to clear up the memleak log. // NeL context must be deleted immediately after debug destroyed, @@ -1196,7 +1203,8 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog) string fn; if (logPath != NULL) { - fn += logPath; + LogPath = CPath::standardizePath(logPath); + fn += LogPath; } else {