aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Logging/Log.cpp
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-08-26 21:50:54 +0200
committerMachiavelli <none@none>2010-08-26 21:50:54 +0200
commit175fece0737a36690a2f9c283809c5b04b5c2a3c (patch)
tree303f8521eca348c13cc650d71f453881586e5854 /src/server/shared/Logging/Log.cpp
parent11de1d43695c289effc5dccb4663d16f927cb657 (diff)
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
Diffstat (limited to 'src/server/shared/Logging/Log.cpp')
-rw-r--r--src/server/shared/Logging/Log.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 6857ea649bb..d7165b1b3b1 100644
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -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)