diff options
Diffstat (limited to 'src/server/shared/Logging/Log.cpp')
-rw-r--r-- | src/server/shared/Logging/Log.cpp | 42 |
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) |