mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-02 02:23:49 +00:00
Revert "Show default options, missing in config files (#908)"
This reverts commit f122ed57bf.
This commit created a critical errors and made the core instable. The feature should be reimplemented in a better way.
This commit is contained in:
@@ -87,6 +87,12 @@ void Log::SetLogFileLevel(char *Level)
|
||||
|
||||
void Log::Initialize()
|
||||
{
|
||||
/// Check whether we'll log GM commands/RA events/character outputs/chat stuffs
|
||||
m_dbChar = sConfigMgr->GetBoolDefault("LogDB.Char", false);
|
||||
m_dbRA = sConfigMgr->GetBoolDefault("LogDB.RA", false);
|
||||
m_dbGM = sConfigMgr->GetBoolDefault("LogDB.GM", false);
|
||||
m_dbChat = sConfigMgr->GetBoolDefault("LogDB.Chat", false);
|
||||
|
||||
/// Realm must be 0 by default
|
||||
SetRealmID(0);
|
||||
|
||||
@@ -102,6 +108,45 @@ void Log::Initialize()
|
||||
logfile = openLogFile("LogFile", "LogTimestamp", "w");
|
||||
InitColors(sConfigMgr->GetStringDefault("LogColors", ""));
|
||||
|
||||
m_gmlog_per_account = sConfigMgr->GetBoolDefault("GmLogPerAccount", false);
|
||||
if (!m_gmlog_per_account)
|
||||
gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a");
|
||||
else
|
||||
{
|
||||
// GM log settings for per account case
|
||||
m_gmlog_filename_format = sConfigMgr->GetStringDefault("GMLogFile", "");
|
||||
if (!m_gmlog_filename_format.empty())
|
||||
{
|
||||
bool m_gmlog_timestamp = sConfigMgr->GetBoolDefault("GmLogTimestamp", false);
|
||||
|
||||
size_t dot_pos = m_gmlog_filename_format.find_last_of('.');
|
||||
if (dot_pos!=m_gmlog_filename_format.npos)
|
||||
{
|
||||
if (m_gmlog_timestamp)
|
||||
m_gmlog_filename_format.insert(dot_pos, m_logsTimestamp);
|
||||
|
||||
m_gmlog_filename_format.insert(dot_pos, "_#%u");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gmlog_filename_format += "_#%u";
|
||||
|
||||
if (m_gmlog_timestamp)
|
||||
m_gmlog_filename_format += m_logsTimestamp;
|
||||
}
|
||||
|
||||
m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
|
||||
}
|
||||
}
|
||||
|
||||
charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a");
|
||||
dberLogfile = openLogFile("DBErrorLogFile", NULL, "a");
|
||||
raLogfile = openLogFile("RaLogFile", NULL, "a");
|
||||
chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a");
|
||||
sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a");
|
||||
sqlDevLogFile = openLogFile("SQLDeveloperLogFile", NULL, "a");
|
||||
miscLogFile = fopen((m_logsDir+"Misc.log").c_str(), "a");
|
||||
|
||||
// Main log file settings
|
||||
m_logLevel = sConfigMgr->GetIntDefault("LogLevel", LOGL_NORMAL);
|
||||
m_logFileLevel = sConfigMgr->GetIntDefault("LogFileLevel", LOGL_NORMAL);
|
||||
@@ -109,6 +154,17 @@ void Log::Initialize()
|
||||
m_sqlDriverQueryLogging = sConfigMgr->GetBoolDefault("SQLDriverQueryLogging", false);
|
||||
|
||||
m_DebugLogMask = DebugLogFilters(sConfigMgr->GetIntDefault("DebugLogMask", LOG_FILTER_NONE));
|
||||
|
||||
// Char log settings
|
||||
m_charLog_Dump = sConfigMgr->GetBoolDefault("CharLogDump", false);
|
||||
m_charLog_Dump_Separate = sConfigMgr->GetBoolDefault("CharLogDump.Separate", false);
|
||||
if (m_charLog_Dump_Separate)
|
||||
{
|
||||
m_dumpsDir = sConfigMgr->GetStringDefault("CharLogDump.SeparateDir", "");
|
||||
if (!m_dumpsDir.empty())
|
||||
if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\'))
|
||||
m_dumpsDir.push_back('/');
|
||||
}
|
||||
}
|
||||
|
||||
void Log::ReloadConfig()
|
||||
@@ -446,8 +502,6 @@ void Log::outSQLDriver(const char* str, ...)
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a");
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vutf8printf(stdout, str, &ap);
|
||||
@@ -513,8 +567,6 @@ void Log::outErrorDb(const char * err, ...)
|
||||
fflush(logfile);
|
||||
}
|
||||
|
||||
dberLogfile = openLogFile("DBErrorLogFile", NULL, "a");
|
||||
|
||||
if (dberLogfile)
|
||||
{
|
||||
outTimestamp(dberLogfile);
|
||||
@@ -630,8 +682,6 @@ void Log::outSQLDev(const char* str, ...)
|
||||
|
||||
printf("\n");
|
||||
|
||||
sqlDevLogFile = openLogFile("SQLDeveloperLogFile", NULL, "a");
|
||||
|
||||
if (sqlDevLogFile)
|
||||
{
|
||||
va_list ap2;
|
||||
@@ -763,8 +813,6 @@ void Log::outCommand(uint32 account, const char * str, ...)
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
m_dbGM = sConfigMgr->GetBoolDefault("LogDB.GM", false);
|
||||
|
||||
// TODO: support accountid
|
||||
if (m_enableLogDB && m_dbGM)
|
||||
{
|
||||
@@ -803,37 +851,6 @@ void Log::outCommand(uint32 account, const char * str, ...)
|
||||
}
|
||||
}
|
||||
|
||||
m_gmlog_per_account = sConfigMgr->GetBoolDefault("GmLogPerAccount", false);
|
||||
if (!m_gmlog_per_account)
|
||||
gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a");
|
||||
else
|
||||
{
|
||||
// GM log settings for per account case
|
||||
m_gmlog_filename_format = sConfigMgr->GetStringDefault("GMLogFile", "");
|
||||
if (!m_gmlog_filename_format.empty())
|
||||
{
|
||||
bool m_gmlog_timestamp = sConfigMgr->GetBoolDefault("GmLogTimestamp", false);
|
||||
|
||||
size_t dot_pos = m_gmlog_filename_format.find_last_of('.');
|
||||
if (dot_pos != m_gmlog_filename_format.npos)
|
||||
{
|
||||
if (m_gmlog_timestamp)
|
||||
m_gmlog_filename_format.insert(dot_pos, m_logsTimestamp);
|
||||
|
||||
m_gmlog_filename_format.insert(dot_pos, "_#%u");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gmlog_filename_format += "_#%u";
|
||||
|
||||
if (m_gmlog_timestamp)
|
||||
m_gmlog_filename_format += m_logsTimestamp;
|
||||
}
|
||||
|
||||
m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_gmlog_per_account)
|
||||
{
|
||||
if (FILE* per_file = openGmlogPerAccount (account))
|
||||
@@ -866,8 +883,6 @@ void Log::outChar(const char * str, ...)
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
m_dbChar = sConfigMgr->GetBoolDefault("LogDB.Char", false);
|
||||
|
||||
if (m_enableLogDB && m_dbChar)
|
||||
{
|
||||
va_list ap2;
|
||||
@@ -878,8 +893,6 @@ void Log::outChar(const char * str, ...)
|
||||
va_end(ap2);
|
||||
}
|
||||
|
||||
charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a");
|
||||
|
||||
if (charLogfile)
|
||||
{
|
||||
outTimestamp(charLogfile);
|
||||
@@ -895,10 +908,6 @@ void Log::outChar(const char * str, ...)
|
||||
void Log::outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
|
||||
charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a");
|
||||
|
||||
m_charLog_Dump_Separate = sConfigMgr->GetBoolDefault("CharLogDump.Separate", false);
|
||||
if (m_charLog_Dump_Separate)
|
||||
{
|
||||
char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0
|
||||
@@ -909,7 +918,6 @@ void Log::outCharDump(const char * str, uint32 account_id, uint32 guid, const ch
|
||||
}
|
||||
else
|
||||
file = charLogfile;
|
||||
|
||||
if (file)
|
||||
{
|
||||
fprintf(file, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n",
|
||||
@@ -925,8 +933,6 @@ void Log::outChat(const char * str, ...)
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
m_dbChat = sConfigMgr->GetBoolDefault("LogDB.Chat", false);
|
||||
|
||||
if (m_enableLogDB && m_dbChat)
|
||||
{
|
||||
va_list ap2;
|
||||
@@ -937,8 +943,6 @@ void Log::outChat(const char * str, ...)
|
||||
va_end(ap2);
|
||||
}
|
||||
|
||||
chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a");
|
||||
|
||||
if (chatLogfile)
|
||||
{
|
||||
outTimestamp(chatLogfile);
|
||||
@@ -956,8 +960,6 @@ void Log::outRemote(const char * str, ...)
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
m_dbRA = sConfigMgr->GetBoolDefault("LogDB.RA", false);
|
||||
|
||||
if (m_enableLogDB && m_dbRA)
|
||||
{
|
||||
va_list ap2;
|
||||
@@ -968,8 +970,6 @@ void Log::outRemote(const char * str, ...)
|
||||
va_end(ap2);
|
||||
}
|
||||
|
||||
raLogfile = openLogFile("RaLogFile", NULL, "a");
|
||||
|
||||
if (raLogfile)
|
||||
{
|
||||
outTimestamp(raLogfile);
|
||||
@@ -987,8 +987,6 @@ void Log::outMisc(const char * str, ...)
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
miscLogFile = fopen((m_logsDir + "Misc.log").c_str(), "a");
|
||||
|
||||
if (m_enableLogDB)
|
||||
{
|
||||
va_list ap2;
|
||||
|
||||
Reference in New Issue
Block a user