mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +00:00
[Sync] Project sync
This commit is contained in:
parent
f1c9e0f94b
commit
86690df496
22 changed files with 1731 additions and 385 deletions
|
|
@ -96,14 +96,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)
|
||||
m_colors[i] = Color(color[i]);
|
||||
{ m_colors[i] = Color(color[i]); }
|
||||
|
||||
m_colored = true;
|
||||
}
|
||||
|
|
@ -199,9 +199,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;
|
||||
{ newLevel = LOG_LVL_DEBUG; }
|
||||
|
||||
m_logLevel = LogLevel(newLevel);
|
||||
|
||||
|
|
@ -213,9 +213,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;
|
||||
{ newLevel = LOG_LVL_DEBUG; }
|
||||
|
||||
m_logFileLevel = LogLevel(newLevel);
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ 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();
|
||||
|
|
@ -239,7 +239,7 @@ 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
|
||||
|
|
@ -252,7 +252,7 @@ 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");
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ 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;
|
||||
|
|
@ -284,7 +284,7 @@ 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);
|
||||
|
|
@ -294,15 +294,15 @@ 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;
|
||||
{ logfn += m_logsTimestamp; }
|
||||
}
|
||||
|
||||
return fopen((m_logsDir + logfn).c_str(), mode);
|
||||
|
|
@ -311,7 +311,7 @@ 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);
|
||||
|
|
@ -362,7 +362,7 @@ std::string Log::GetTimestampStr()
|
|||
void Log::outString()
|
||||
{
|
||||
if (m_includeTime)
|
||||
outTime();
|
||||
{ outTime(); }
|
||||
printf("\n");
|
||||
if (logfile)
|
||||
{
|
||||
|
|
@ -377,13 +377,13 @@ 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;
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ void Log::outString(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(true);
|
||||
{ ResetColor(true); }
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
|
@ -414,13 +414,13 @@ void Log::outString(const char* str, ...)
|
|||
void Log::outError(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;
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ void Log::outError(const char* err, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(false);
|
||||
{ ResetColor(false); }
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
if (logfile)
|
||||
|
|
@ -451,7 +451,7 @@ void Log::outError(const char* err, ...)
|
|||
void Log::outErrorDb()
|
||||
{
|
||||
if (m_includeTime)
|
||||
outTime();
|
||||
{ outTime(); }
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -475,13 +475,13 @@ 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;
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ void Log::outErrorDb(const char* err, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(false);
|
||||
{ ResetColor(false); }
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -526,7 +526,7 @@ void Log::outErrorDb(const char* err, ...)
|
|||
void Log::outErrorEventAI()
|
||||
{
|
||||
if (m_includeTime)
|
||||
outTime();
|
||||
{ outTime(); }
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -550,13 +550,13 @@ 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;
|
||||
|
||||
|
|
@ -565,7 +565,7 @@ void Log::outErrorEventAI(const char* err, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(false);
|
||||
{ ResetColor(false); }
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -601,15 +601,15 @@ 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);
|
||||
|
|
@ -617,7 +617,7 @@ void Log::outBasic(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(true);
|
||||
{ ResetColor(true); }
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -639,15 +639,15 @@ 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);
|
||||
|
|
@ -655,7 +655,7 @@ void Log::outDetail(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(true);
|
||||
{ ResetColor(true); }
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -679,15 +679,15 @@ void Log::outDetail(const char* str, ...)
|
|||
void Log::outDebug(const char* str, ...)
|
||||
{
|
||||
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);
|
||||
|
|
@ -695,7 +695,7 @@ void Log::outDebug(const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(true);
|
||||
{ ResetColor(true); }
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -719,15 +719,15 @@ 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);
|
||||
|
|
@ -735,7 +735,7 @@ void Log::outCommand(uint32 account, const char* str, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(true);
|
||||
{ ResetColor(true); }
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -781,7 +781,7 @@ void Log::outCommand(uint32 account, const char* str, ...)
|
|||
void Log::outChar(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
if (charLogfile)
|
||||
{
|
||||
|
|
@ -798,7 +798,7 @@ void Log::outChar(const char* str, ...)
|
|||
void Log::outErrorScriptLib()
|
||||
{
|
||||
if (m_includeTime)
|
||||
outTime();
|
||||
{ outTime(); }
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -806,9 +806,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>: ");
|
||||
{ fprintf(logfile, "<Scripting Library ERROR>: "); }
|
||||
fflush(logfile);
|
||||
}
|
||||
|
||||
|
|
@ -825,13 +825,13 @@ 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;
|
||||
|
||||
|
|
@ -840,7 +840,7 @@ void Log::outErrorScriptLib(const char* err, ...)
|
|||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
ResetColor(false);
|
||||
{ ResetColor(false); }
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
@ -848,9 +848,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>: ");
|
||||
{ fprintf(logfile, "<Scripting Library ERROR>: "); }
|
||||
|
||||
va_start(ap, err);
|
||||
vfprintf(logfile, err, ap);
|
||||
|
|
@ -879,7 +879,7 @@ 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);
|
||||
|
||||
|
|
@ -893,7 +893,7 @@ void Log::outWorldPacketDump(uint32 socket, uint32 opcode, char const* opcodeNam
|
|||
while (p < packet->size())
|
||||
{
|
||||
for (size_t j = 0; j < 16 && p < packet->size(); ++j)
|
||||
fprintf(worldLogfile, "%.2X ", (*packet)[p++]);
|
||||
{ fprintf(worldLogfile, "%.2X ", (*packet)[p++]); }
|
||||
|
||||
fprintf(worldLogfile, "\n");
|
||||
}
|
||||
|
|
@ -914,7 +914,7 @@ 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)
|
||||
{
|
||||
|
|
@ -958,7 +958,7 @@ void Log::setScriptLibraryErrorFile(char const* fname, char const* libName)
|
|||
m_scriptLibName = libName;
|
||||
|
||||
if (scriptErrLogFile)
|
||||
fclose(scriptErrLogFile);
|
||||
{ fclose(scriptErrLogFile); }
|
||||
|
||||
if (!fname)
|
||||
{
|
||||
|
|
@ -974,7 +974,7 @@ 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;
|
||||
|
|
@ -988,7 +988,7 @@ void outstring_log(const char* str, ...)
|
|||
void detail_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1002,7 +1002,7 @@ void detail_log(const char* str, ...)
|
|||
void debug_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1016,7 +1016,7 @@ void debug_log(const char* str, ...)
|
|||
void error_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1030,7 +1030,7 @@ void error_log(const char* str, ...)
|
|||
void error_db_log(const char* str, ...)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
char buf[256];
|
||||
va_list ap;
|
||||
|
|
@ -1049,7 +1049,7 @@ 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue