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

View File

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