Fixed: #990 Add possibility to set and get log directory

This commit is contained in:
kervala 2010-06-21 20:24:02 +02:00
parent 2c1853cb1c
commit 1d95df22f9
2 changed files with 13 additions and 2 deletions

View file

@ -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);

View file

@ -93,6 +93,7 @@ namespace NLMISC
bool DisableNLDebug= false;
NLMISC::CVariablePtr<bool> _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
{