mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 04:37:02 +00:00
Apply style fix
This commit is contained in:
parent
5531a0087d
commit
35405dd549
155 changed files with 10968 additions and 3660 deletions
|
|
@ -100,10 +100,14 @@ void Log::InitColors(const std::string& str)
|
|||
ss >> color[i];
|
||||
|
||||
if (!ss)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (color[i] < 0 || color[i] >= Color_count)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < LogType_count; ++i)
|
||||
|
|
@ -197,7 +201,9 @@ void Log::SetLogLevel(char* level)
|
|||
int32 newLevel = atoi((char*)level);
|
||||
|
||||
if (newLevel < LOG_LVL_MINIMAL)
|
||||
{ newLevel = LOG_LVL_MINIMAL; }
|
||||
{
|
||||
newLevel = LOG_LVL_MINIMAL;
|
||||
}
|
||||
else if (newLevel > LOG_LVL_DEBUG)
|
||||
{ newLevel = LOG_LVL_DEBUG; }
|
||||
|
||||
|
|
@ -211,7 +217,9 @@ void Log::SetLogFileLevel(char* level)
|
|||
int32 newLevel = atoi((char*)level);
|
||||
|
||||
if (newLevel < LOG_LVL_MINIMAL)
|
||||
{ newLevel = LOG_LVL_MINIMAL; }
|
||||
{
|
||||
newLevel = LOG_LVL_MINIMAL;
|
||||
}
|
||||
else if (newLevel > LOG_LVL_DEBUG)
|
||||
{ newLevel = LOG_LVL_DEBUG; }
|
||||
|
||||
|
|
@ -227,7 +235,9 @@ void Log::Initialize()
|
|||
if (!m_logsDir.empty())
|
||||
{
|
||||
if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
|
||||
{ m_logsDir.append("/"); }
|
||||
{
|
||||
m_logsDir.append("/");
|
||||
}
|
||||
}
|
||||
|
||||
m_logsTimestamp = "_" + GetTimestampStr();
|
||||
|
|
@ -237,7 +247,9 @@ void Log::Initialize()
|
|||
|
||||
m_gmlog_per_account = sConfig.GetBoolDefault("GmLogPerAccount", false);
|
||||
if (!m_gmlog_per_account)
|
||||
{ gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a"); }
|
||||
{
|
||||
gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a");
|
||||
}
|
||||
else
|
||||
{
|
||||
// GM log settings for per account case
|
||||
|
|
@ -250,7 +262,9 @@ void Log::Initialize()
|
|||
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, m_logsTimestamp);
|
||||
}
|
||||
|
||||
m_gmlog_filename_format.insert(dot_pos, "_#%u");
|
||||
}
|
||||
|
|
@ -259,7 +273,9 @@ void Log::Initialize()
|
|||
m_gmlog_filename_format += "_#%u";
|
||||
|
||||
if (m_gmlog_timestamp)
|
||||
{ m_gmlog_filename_format += m_logsTimestamp; }
|
||||
{
|
||||
m_gmlog_filename_format += m_logsTimestamp;
|
||||
}
|
||||
}
|
||||
|
||||
m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
|
||||
|
|
@ -286,7 +302,9 @@ void Log::Initialize()
|
|||
for (int i = 0; i < LOG_FILTER_COUNT; ++i)
|
||||
if (*logFilterData[i].name)
|
||||
if (sConfig.GetBoolDefault(logFilterData[i].configName, logFilterData[i].defaultState))
|
||||
{ m_logFilter |= (1 << i); }
|
||||
{
|
||||
m_logFilter |= (1 << i);
|
||||
}
|
||||
|
||||
// Char log settings
|
||||
m_charLog_Dump = sConfig.GetBoolDefault("CharLogDump", false);
|
||||
|
|
@ -296,13 +314,17 @@ FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFl
|
|||
{
|
||||
std::string logfn = sConfig.GetStringDefault(configFileName, "");
|
||||
if (logfn.empty())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (configTimeStampFlag && sConfig.GetBoolDefault(configTimeStampFlag, false))
|
||||
{
|
||||
size_t dot_pos = logfn.find_last_of(".");
|
||||
if (dot_pos != logfn.npos)
|
||||
{ logfn.insert(dot_pos, m_logsTimestamp); }
|
||||
{
|
||||
logfn.insert(dot_pos, m_logsTimestamp);
|
||||
}
|
||||
else
|
||||
{ logfn += m_logsTimestamp; }
|
||||
}
|
||||
|
|
@ -313,7 +335,9 @@ FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFl
|
|||
FILE* Log::openGmlogPerAccount(uint32 account)
|
||||
{
|
||||
if (m_gmlog_filename_format.empty())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char namebuf[MANGOS_PATH_MAX];
|
||||
snprintf(namebuf, MANGOS_PATH_MAX, m_gmlog_filename_format.c_str(), account);
|
||||
|
|
@ -364,7 +388,9 @@ std::string Log::GetTimestampStr()
|
|||
void Log::outString()
|
||||
{
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
printf("\n");
|
||||
if (logfile)
|
||||
{
|
||||
|
|
@ -379,13 +405,19 @@ void Log::outString()
|
|||
void Log::outString(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_colored)
|
||||
{ SetColor(true, m_colors[LogNormal]); }
|
||||
{
|
||||
SetColor(true, m_colors[LogNormal]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
|
||||
|
|
@ -394,7 +426,9 @@ void Log::outString(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(true); }
|
||||
{
|
||||
ResetColor(true);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
|
@ -461,7 +495,9 @@ void Log::outError(const char* err, ...)
|
|||
void Log::outErrorDb()
|
||||
{
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -485,13 +521,19 @@ void Log::outErrorDb()
|
|||
void Log::outErrorDb(const char* err, ...)
|
||||
{
|
||||
if (!err)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_colored)
|
||||
{ SetColor(false, m_colors[LogError]); }
|
||||
{
|
||||
SetColor(false, m_colors[LogError]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
|
||||
|
|
@ -500,7 +542,9 @@ void Log::outErrorDb(const char* err, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(false); }
|
||||
{
|
||||
ResetColor(false);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -621,7 +665,9 @@ void Log::outErrorEluna(const char* err, ...) {}
|
|||
void Log::outErrorEventAI()
|
||||
{
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -645,13 +691,19 @@ void Log::outErrorEventAI()
|
|||
void Log::outErrorEventAI(const char* err, ...)
|
||||
{
|
||||
if (!err)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_colored)
|
||||
{ SetColor(false, m_colors[LogError]); }
|
||||
{
|
||||
SetColor(false, m_colors[LogError]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
|
||||
|
|
@ -660,7 +712,9 @@ void Log::outErrorEventAI(const char* err, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(false); }
|
||||
{
|
||||
ResetColor(false);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -696,15 +750,21 @@ void Log::outErrorEventAI(const char* err, ...)
|
|||
void Log::outBasic(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_logLevel >= LOG_LVL_BASIC)
|
||||
{
|
||||
if (m_colored)
|
||||
{ SetColor(true, m_colors[LogDetails]); }
|
||||
{
|
||||
SetColor(true, m_colors[LogDetails]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
|
|
@ -712,7 +772,9 @@ void Log::outBasic(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(true); }
|
||||
{
|
||||
ResetColor(true);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -734,15 +796,21 @@ void Log::outBasic(const char* str, ...)
|
|||
void Log::outDetail(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_logLevel >= LOG_LVL_DETAIL)
|
||||
{
|
||||
if (m_colored)
|
||||
{ SetColor(true, m_colors[LogDetails]); }
|
||||
{
|
||||
SetColor(true, m_colors[LogDetails]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
|
|
@ -750,7 +818,9 @@ void Log::outDetail(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(true); }
|
||||
{
|
||||
ResetColor(true);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -775,15 +845,21 @@ void Log::outDebug(const char* str, ...)
|
|||
{
|
||||
#ifdef MANGOS_DEBUG
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_logLevel >= LOG_LVL_DEBUG)
|
||||
{
|
||||
if (m_colored)
|
||||
{ SetColor(true, m_colors[LogDebug]); }
|
||||
{
|
||||
SetColor(true, m_colors[LogDebug]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
|
|
@ -791,7 +867,9 @@ void Log::outDebug(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(true); }
|
||||
{
|
||||
ResetColor(true);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -816,15 +894,21 @@ void Log::outDebug(const char* str, ...)
|
|||
void Log::outCommand(uint32 account, const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_logLevel >= LOG_LVL_DETAIL)
|
||||
{
|
||||
if (m_colored)
|
||||
{ SetColor(true, m_colors[LogDetails]); }
|
||||
{
|
||||
SetColor(true, m_colors[LogDetails]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
|
|
@ -832,7 +916,9 @@ void Log::outCommand(uint32 account, const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(true); }
|
||||
{
|
||||
ResetColor(true);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -941,7 +1027,9 @@ void Log::outWarden(const char* str, ...)
|
|||
void Log::outChar(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (charLogfile)
|
||||
{
|
||||
|
|
@ -958,7 +1046,9 @@ void Log::outChar(const char* str, ...)
|
|||
void Log::outErrorScriptLib()
|
||||
{
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -966,7 +1056,9 @@ void Log::outErrorScriptLib()
|
|||
{
|
||||
outTimestamp(logfile);
|
||||
if (m_scriptLibName)
|
||||
{ fprintf(logfile, "<%s ERROR:> ", m_scriptLibName); }
|
||||
{
|
||||
fprintf(logfile, "<%s ERROR:> ", m_scriptLibName);
|
||||
}
|
||||
else
|
||||
{ fprintf(logfile, "<Scripting Library ERROR>: "); }
|
||||
fflush(logfile);
|
||||
|
|
@ -985,13 +1077,19 @@ void Log::outErrorScriptLib()
|
|||
void Log::outErrorScriptLib(const char* err, ...)
|
||||
{
|
||||
if (!err)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_colored)
|
||||
{ SetColor(false, m_colors[LogError]); }
|
||||
{
|
||||
SetColor(false, m_colors[LogError]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
|
||||
|
|
@ -1000,7 +1098,9 @@ void Log::outErrorScriptLib(const char* err, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(false); }
|
||||
{
|
||||
ResetColor(false);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -1008,7 +1108,9 @@ void Log::outErrorScriptLib(const char* err, ...)
|
|||
{
|
||||
outTimestamp(logfile);
|
||||
if (m_scriptLibName)
|
||||
{ fprintf(logfile, "<%s ERROR>: ", m_scriptLibName); }
|
||||
{
|
||||
fprintf(logfile, "<%s ERROR>: ", m_scriptLibName);
|
||||
}
|
||||
else
|
||||
{ fprintf(logfile, "<Scripting Library ERROR>: "); }
|
||||
|
||||
|
|
@ -1039,7 +1141,9 @@ void Log::outErrorScriptLib(const char* err, ...)
|
|||
void Log::outWorldPacketDump(uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming)
|
||||
{
|
||||
if (!worldLogfile)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ACE_GUARD(ACE_Thread_Mutex, GuardObj, m_worldLogMtx);
|
||||
|
||||
|
|
@ -1074,7 +1178,9 @@ void Log::outCharDump(const char* str, uint32 account_id, uint32 guid, const cha
|
|||
void Log::outRALog(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (raLogfile)
|
||||
{
|
||||
|
|
@ -1118,7 +1224,9 @@ void Log::setScriptLibraryErrorFile(char const* fname, char const* libName)
|
|||
m_scriptLibName = libName;
|
||||
|
||||
if (scriptErrLogFile)
|
||||
{ fclose(scriptErrLogFile); }
|
||||
{
|
||||
fclose(scriptErrLogFile);
|
||||
}
|
||||
|
||||
if (!fname)
|
||||
{
|
||||
|
|
@ -1134,7 +1242,9 @@ void Log::setScriptLibraryErrorFile(char const* fname, char const* libName)
|
|||
void outstring_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1148,7 +1258,9 @@ void outstring_log(const char* str, ...)
|
|||
void detail_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1162,7 +1274,9 @@ void detail_log(const char* str, ...)
|
|||
void debug_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1176,7 +1290,9 @@ void debug_log(const char* str, ...)
|
|||
void error_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1190,7 +1306,9 @@ void error_log(const char* str, ...)
|
|||
void error_db_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1209,7 +1327,9 @@ void setScriptLibraryErrorFile(char const* fname, char const* libName)
|
|||
void script_error_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
|
|||
|
|
@ -133,19 +133,27 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
|||
~Log()
|
||||
{
|
||||
if (logfile != NULL)
|
||||
{ fclose(logfile); }
|
||||
{
|
||||
fclose(logfile);
|
||||
}
|
||||
logfile = NULL;
|
||||
|
||||
if (gmLogfile != NULL)
|
||||
{ fclose(gmLogfile); }
|
||||
{
|
||||
fclose(gmLogfile);
|
||||
}
|
||||
gmLogfile = NULL;
|
||||
|
||||
if (charLogfile != NULL)
|
||||
{ fclose(charLogfile); }
|
||||
{
|
||||
fclose(charLogfile);
|
||||
}
|
||||
charLogfile = NULL;
|
||||
|
||||
if (dberLogfile != NULL)
|
||||
{ fclose(dberLogfile); }
|
||||
{
|
||||
fclose(dberLogfile);
|
||||
}
|
||||
dberLogfile = NULL;
|
||||
|
||||
#ifdef ENABLE_ELUNA
|
||||
|
|
@ -155,19 +163,27 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
|||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
if (eventAiErLogfile != NULL)
|
||||
{ fclose(eventAiErLogfile); }
|
||||
{
|
||||
fclose(eventAiErLogfile);
|
||||
}
|
||||
eventAiErLogfile = NULL;
|
||||
|
||||
if (scriptErrLogFile != NULL)
|
||||
{ fclose(scriptErrLogFile); }
|
||||
{
|
||||
fclose(scriptErrLogFile);
|
||||
}
|
||||
scriptErrLogFile = NULL;
|
||||
|
||||
if (raLogfile != NULL)
|
||||
{ fclose(raLogfile); }
|
||||
{
|
||||
fclose(raLogfile);
|
||||
}
|
||||
raLogfile = NULL;
|
||||
|
||||
if (worldLogfile != NULL)
|
||||
{ fclose(worldLogfile); }
|
||||
{
|
||||
fclose(worldLogfile);
|
||||
}
|
||||
worldLogfile = NULL;
|
||||
|
||||
if (wardenLogfile != NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue