[Glide64] Use log dir from settings

This commit is contained in:
zilmar 2017-01-24 08:34:08 +11:00
parent d1887bd0e5
commit 4305890799
2 changed files with 14 additions and 28 deletions

View File

@ -1,13 +1,11 @@
#include "trace.h" #include "trace.h"
#include "Config.h" #include "Config.h"
#include "settings.h"
#include <string.h> #include <string.h>
#include <Common/Trace.h> #include <Common/Trace.h>
#include <Common/path.h> #include <Common/path.h>
#include <Common/LogClass.h> #include <Common/LogClass.h>
#include <Settings/Settings.h>
extern short Set_log_dir, Set_log_flush;
#ifdef ANDROID #ifdef ANDROID
#include <android/log.h> #include <android/log.h>
@ -57,7 +55,6 @@ void SetupTrace(void)
TraceSetMaxModule(MaxTraceModuleGlide64, TraceError); TraceSetMaxModule(MaxTraceModuleGlide64, TraceError);
#endif #endif
TraceSetModuleName(TraceMD5, "MD5"); TraceSetModuleName(TraceMD5, "MD5");
TraceSetModuleName(TraceThread, "Thread"); TraceSetModuleName(TraceThread, "Thread");
TraceSetModuleName(TracePath, "Path"); TraceSetModuleName(TracePath, "Path");
@ -72,14 +69,8 @@ void SetupTrace(void)
TraceSetModuleName(TracePNG, "PNG"); TraceSetModuleName(TracePNG, "PNG");
TraceSetModuleName(TraceOGLWrapper, "OGL Wrapper"); TraceSetModuleName(TraceOGLWrapper, "OGL Wrapper");
char log_dir[260]; const char * log_dir = g_settings->log_dir();
memset(log_dir, 0, sizeof(log_dir)); if (log_dir == NULL || log_dir[0] == '\0')
if (Set_log_dir != 0)
{
GetSystemSettingSz(Set_log_dir, log_dir, sizeof(log_dir));
}
if (strlen(log_dir) == 0)
{ {
return; return;
} }
@ -89,6 +80,6 @@ void SetupTrace(void)
{ {
LogFilePath.DirectoryCreate(); LogFilePath.DirectoryCreate();
} }
g_LogFile = new CTraceFileLog(LogFilePath, GetSystemSetting(Set_log_flush) != 0, CLog::Log_New, 500); g_LogFile = new CTraceFileLog(LogFilePath, g_settings->FlushLogs(), CLog::Log_New, 500);
TraceAddModule(g_LogFile); TraceAddModule(g_LogFile);
} }

View File

@ -29,33 +29,28 @@
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Common/path.h> #include <Common/path.h>
#include <Glide64/Config.h> #include <Glide64/Config.h>
#include <Settings/Settings.h> #include <Glide64/Settings.h>
extern short Set_log_dir;
TxDbg::TxDbg() TxDbg::TxDbg()
{ {
const char * log_dir = g_settings->log_dir();
char log_dir[260]; if (log_dir != NULL && log_dir[0] != '\0')
memset(log_dir, 0, sizeof(log_dir));
if (Set_log_dir != 0)
{ {
GetSystemSettingSz(Set_log_dir, log_dir, sizeof(log_dir)); _level = DBG_LEVEL;
}
_level = DBG_LEVEL; if (!_dbgfile)
if (!_dbgfile)
#ifdef GHQCHK #ifdef GHQCHK
_dbgfile = fopen(CPath(log_dir, "ghqchk.txt"), "w"); _dbgfile = fopen(CPath(log_dir, "ghqchk.txt"), "w");
#else #else
_dbgfile = fopen(CPath(log_dir, "glidehq.dbg"), "w"); _dbgfile = fopen(CPath(log_dir, "glidehq.dbg"), "w");
#endif #endif
}
} }
TxDbg::~TxDbg() TxDbg::~TxDbg()
{ {
if (_dbgfile) { if (_dbgfile)
{
fclose(_dbgfile); fclose(_dbgfile);
_dbgfile = 0; _dbgfile = 0;
} }