mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-11 03:42:24 +00:00
Gut more of debug.cpp/.h
This commit is contained in:
parent
2a6a3e419c
commit
4d6c2be191
@ -58,28 +58,10 @@ static volatile bool logFileValid = false;
|
||||
static EQEmuLog realLogFile;
|
||||
EQEmuLog *LogFile = &realLogFile;
|
||||
|
||||
static const char* FileNames[EQEmuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" };
|
||||
static const char* LogNames[EQEmuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" };
|
||||
|
||||
EQEmuLog::EQEmuLog()
|
||||
{
|
||||
pLogStatus[EQEmuLog::LogIDs::Status] = LOG_LEVEL_STATUS;
|
||||
pLogStatus[EQEmuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL;
|
||||
pLogStatus[EQEmuLog::LogIDs::Error] = LOG_LEVEL_ERROR;
|
||||
pLogStatus[EQEmuLog::LogIDs::Debug] = LOG_LEVEL_DEBUG;
|
||||
pLogStatus[EQEmuLog::LogIDs::Quest] = LOG_LEVEL_QUEST;
|
||||
pLogStatus[EQEmuLog::LogIDs::Commands] = LOG_LEVEL_COMMANDS;
|
||||
pLogStatus[EQEmuLog::LogIDs::Crash] = LOG_LEVEL_CRASH;
|
||||
logFileValid = true;
|
||||
}
|
||||
|
||||
EQEmuLog::~EQEmuLog()
|
||||
{
|
||||
logFileValid = false;
|
||||
for (int i = 0; i < MaxLogID; i++) {
|
||||
LockMutex lock(&MLog[i]); //to prevent termination race
|
||||
if (fp[i]) {
|
||||
fclose(fp[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,34 +78,7 @@ class EQEmuLog {
|
||||
public:
|
||||
EQEmuLog();
|
||||
~EQEmuLog();
|
||||
|
||||
enum LogIDs {
|
||||
Status = 0, /* This must stay the first entry in this list */
|
||||
Normal, /* Normal Logs */
|
||||
Error, /* Error Logs */
|
||||
Debug, /* Debug Logs */
|
||||
Quest, /* Quest Logs */
|
||||
Commands, /* Issued Comamnds */
|
||||
Crash, /* Crash Logs */
|
||||
Save, /* Client Saves */
|
||||
MaxLogID /* Max, used in functions to get the max log ID */
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Mutex MOpen;
|
||||
Mutex MLog[MaxLogID];
|
||||
FILE* fp[MaxLogID];
|
||||
|
||||
/* LogStatus: bitwise variable
|
||||
1 = output to file
|
||||
2 = output to stdout
|
||||
4 = fopen error, dont retry
|
||||
8 = use stderr instead (2 must be set)
|
||||
*/
|
||||
uint8 pLogStatus[MaxLogID];
|
||||
|
||||
};
|
||||
|
||||
extern EQEmuLog* LogFile;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user