Core/Logging:

- Implement sLog.outSQLDriver that will log SQL driver related events (non-content related).
- Queries will now be logged into this file as well instead of normal log file (requires debug build).
- Don´t forget to update your authserver.conf and worldserver.conf
Core/build:
- Fix non-PCH build

--HG--
branch : trunk
This commit is contained in:
Machiavelli committed 2010-08-26 21:50:54 +02:00
1 parent 11de1d4369
commit 175fece073
7 files changed
+74 -30

No files matched your search

+35 -7
View File
@@ -28,7 +28,7 @@
Log::Log() :
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
dberLogfile(NULL), chatLogfile(NULL), arenaLogFile(NULL),
dberLogfile(NULL), chatLogfile(NULL), arenaLogFile(NULL), sqlLogFile(NULL),
m_gmlog_per_account(false), m_enableLogDBLater(false),
m_enableLogDB(false), m_colored(false)
{
@@ -64,6 +64,10 @@ Log::~Log()
if (arenaLogFile != NULL)
fclose(arenaLogFile);
arenaLogFile = NULL;
if (sqlLogFile != NULL)
fclose(sqlLogFile);
sqlLogFile = NULL;
}
void Log::SetLogLevel(char *Level)
@@ -150,12 +154,12 @@ void Log::Initialize()
}
}
charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a");
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
raLogfile = openLogFile("RaLogFile",NULL,"a");
chatLogfile = openLogFile("ChatLogFile","ChatLogTimestamp","a");
arenaLogFile = openLogFile("ArenaLogFile",NULL,"a");
charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a");
dberLogfile = openLogFile("DBErrorLogFile", NULL, "a");
raLogfile = openLogFile("RaLogFile", NULL, "a");
chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a");
arenaLogFile = openLogFile("ArenaLogFile", NULL,"a");
sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a");
// Main log file settings
m_logLevel = sConfig.GetIntDefault("LogLevel", LOGL_NORMAL);
@@ -529,6 +533,30 @@ void Log::outArena(const char * str, ...)
}
}
void Log::outSQLDriver(const char* str, ...)
{
if (!str)
return;
va_list ap;
va_start(ap, str);
vutf8printf(stdout, str, &ap);
va_end(ap);
printf("\n");
if (sqlLogFile)
{
outTimestamp(sqlLogFile);
va_start(ap, str);
vfprintf(sqlLogFile, str, ap);
fprintf(sqlLogFile, "\n");
va_end(ap);
fflush(sqlLogFile);
}
fflush(stdout);
}
void Log::outErrorDb(const char * err, ...)
{
if (!err)