Header and code cleanup of debug.cpp

This commit is contained in:
Akkadius 2014-12-07 03:02:57 -06:00
parent 3e73df2c72
commit afd3b9acdc

View File

@ -1,7 +1,5 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <cstdarg>
#include <time.h>
#ifdef _WINDOWS #ifdef _WINDOWS
#include <process.h> #include <process.h>
@ -19,7 +17,6 @@
#endif #endif
#include "debug.h" #include "debug.h"
#include "string_util.h"
#include "misc_functions.h" #include "misc_functions.h"
#include "platform.h" #include "platform.h"
@ -34,34 +31,37 @@ 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* 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" }; static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" };
EQEMuLog::EQEMuLog() { EQEMuLog::EQEMuLog()
for (int i=0; i<MaxLogID; i++) { {
for (int i = 0; i < MaxLogID; i++) {
fp[i] = 0; fp[i] = 0;
logCallbackFmt[i] = nullptr; logCallbackFmt[i] = nullptr;
logCallbackBuf[i] = nullptr; logCallbackBuf[i] = nullptr;
logCallbackPva[i] = nullptr; logCallbackPva[i] = nullptr;
} }
pLogStatus[EQEMuLog::LogIDs::Status] = LOG_LEVEL_STATUS;
pLogStatus[Status] = LOG_LEVEL_STATUS; pLogStatus[EQEMuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL;
pLogStatus[Normal] = LOG_LEVEL_NORMAL; pLogStatus[EQEMuLog::LogIDs::Error] = LOG_LEVEL_ERROR;
pLogStatus[Error] = LOG_LEVEL_ERROR; pLogStatus[EQEMuLog::LogIDs::Debug] = LOG_LEVEL_DEBUG;
pLogStatus[Debug] = LOG_LEVEL_DEBUG; pLogStatus[EQEMuLog::LogIDs::Quest] = LOG_LEVEL_QUEST;
pLogStatus[Quest] = LOG_LEVEL_QUEST; pLogStatus[EQEMuLog::LogIDs::Commands] = LOG_LEVEL_COMMANDS;
pLogStatus[Commands] = LOG_LEVEL_COMMANDS; pLogStatus[EQEMuLog::LogIDs::Crash] = LOG_LEVEL_CRASH;
pLogStatus[Crash] = LOG_LEVEL_CRASH;
logFileValid = true; logFileValid = true;
} }
EQEMuLog::~EQEMuLog() { EQEMuLog::~EQEMuLog()
{
logFileValid = false; logFileValid = false;
for (int i=0; i<MaxLogID; i++) { for (int i = 0; i < MaxLogID; i++) {
LockMutex lock(&MLog[i]); //to prevent termination race LockMutex lock(&MLog[i]); //to prevent termination race
if (fp[i]) if (fp[i]) {
fclose(fp[i]); fclose(fp[i]);
}
} }
} }
bool EQEMuLog::open(LogIDs id) { bool EQEMuLog::open(LogIDs id)
{
if (!logFileValid) { if (!logFileValid) {
return false; return false;
} }
@ -76,114 +76,44 @@ bool EQEMuLog::open(LogIDs id) {
//cerr<<"Warning: LogFile already open"<<endl; //cerr<<"Warning: LogFile already open"<<endl;
return true; return true;
} }
char exename[200] = ""; char exename[200] = "";
const EQEmuExePlatform &platform = GetExecutablePlatform(); const EQEmuExePlatform &platform = GetExecutablePlatform();
if(platform == ExePlatformWorld) { if (platform == ExePlatformWorld) {
snprintf(exename, sizeof(exename), "_world"); snprintf(exename, sizeof(exename), "_world");
} else if(platform == ExePlatformZone) { } else if (platform == ExePlatformZone) {
snprintf(exename, sizeof(exename), "_zone"); snprintf(exename, sizeof(exename), "_zone");
} else if(platform == ExePlatformLaunch) { } else if (platform == ExePlatformLaunch) {
snprintf(exename, sizeof(exename), "_launch"); snprintf(exename, sizeof(exename), "_launch");
} else if(platform == ExePlatformUCS) { } else if (platform == ExePlatformUCS) {
snprintf(exename, sizeof(exename), "_ucs"); snprintf(exename, sizeof(exename), "_ucs");
} else if(platform == ExePlatformQueryServ) { } else if (platform == ExePlatformQueryServ) {
snprintf(exename, sizeof(exename), "_queryserv"); snprintf(exename, sizeof(exename), "_queryserv");
} else if(platform == ExePlatformSharedMemory) { } else if (platform == ExePlatformSharedMemory) {
snprintf(exename, sizeof(exename), "_shared_memory"); snprintf(exename, sizeof(exename), "_shared_memory");
} else if(platform == ExePlatformClientImport) { } else if (platform == ExePlatformClientImport) {
snprintf(exename, sizeof(exename), "_import"); snprintf(exename, sizeof(exename), "_import");
} else if(platform == ExePlatformClientExport) { } else if (platform == ExePlatformClientExport) {
snprintf(exename, sizeof(exename), "_export"); snprintf(exename, sizeof(exename), "_export");
} }
char filename[200]; char filename[200];
#ifndef NO_PIDLOG #ifndef NO_PIDLOG
snprintf(filename, sizeof(filename), "%s%s_%04i.log", FileNames[id], exename, getpid()); snprintf(filename, sizeof(filename), "%s%s_%04i.log", FileNames[id], exename, getpid());
#else #else
snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename); snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
#endif #endif
fp[id] = fopen(filename, "a"); fp[id] = fopen(filename, "a");
if (!fp[id]) { if (!fp[id]) {
std::cerr << "Failed to open log file: " << filename << std::endl; std::cerr << "Failed to open log file: " << filename << std::endl;
pLogStatus[id] |= 4; // set file state to error pLogStatus[id] |= 4; // set file state to error
return false; return false;
} }
fputs("---------------------------------------------\n",fp[id]); fputs("---------------------------------------------\n", fp[id]);
write(id, "Starting Log: %s", filename); write(id, "Starting Log: %s", filename);
return true; return true;
} }
bool EQEMuLog::write(LogIDs id, const char *fmt, ...) { bool EQEMuLog::write(LogIDs id, const char *fmt, ...)
if (!logFileValid) { {
return false;
}
if (id >= MaxLogID) {
return false;
}
bool dofile = false;
if (pLogStatus[id] & 1) {
dofile = open(id);
}
if (!(dofile || pLogStatus[id] & 2))
return false;
LockMutex lock(&MLog[id]);
if (!logFileValid)
return false; //check again for threading race reasons (to avoid two mutexes)
time_t aclock;
struct tm *newtime;
time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */
if (dofile)
#ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#endif
va_list argptr, tmpargptr;
va_start(argptr, fmt);
if (dofile) {
va_copy(tmpargptr, argptr);
vfprintf( fp[id], fmt, tmpargptr );
}
if(logCallbackFmt[id]) {
msgCallbackFmt p = logCallbackFmt[id];
va_copy(tmpargptr, argptr);
p(id, fmt, tmpargptr );
}
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
fprintf(stderr, "[%s] ", LogNames[id]);
vfprintf( stderr, fmt, argptr );
}
else {
fprintf(stdout, "[%s] ", LogNames[id]);
vfprintf( stdout, fmt, argptr );
}
}
va_end(argptr);
if (dofile)
fprintf(fp[id], "\n");
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
fprintf(stderr, "\n");
fflush(stderr);
} else {
fprintf(stdout, "\n");
fflush(stdout);
}
}
if(dofile)
fflush(fp[id]);
return true;
}
//write with Prefix and a VA_list
bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) {
if (!logFileValid) { if (!logFileValid) {
return false; return false;
} }
@ -198,56 +128,61 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list
return false; return false;
} }
LockMutex lock(&MLog[id]); LockMutex lock(&MLog[id]);
if (!logFileValid) if (!logFileValid) {
return false; //check again for threading race reasons (to avoid two mutexes) return false; //check again for threading race reasons (to avoid two mutexes)
}
time_t aclock; time_t aclock;
struct tm *newtime; struct tm *newtime;
time( &aclock ); /* Get time in seconds */ time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */ newtime = localtime( &aclock ); /* Convert time to struct */
if (dofile)
va_list tmpargptr; #ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#endif
va_list argptr, tmpargptr;
va_start(argptr, fmt);
if (dofile) { if (dofile) {
#ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
#else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
#endif
va_copy(tmpargptr, argptr); va_copy(tmpargptr, argptr);
vfprintf( fp[id], fmt, tmpargptr ); vfprintf( fp[id], fmt, tmpargptr );
} }
if(logCallbackPva[id]) { if (logCallbackFmt[id]) {
msgCallbackPva p = logCallbackPva[id]; msgCallbackFmt p = logCallbackFmt[id];
va_copy(tmpargptr, argptr); va_copy(tmpargptr, argptr);
p(id, prefix, fmt, tmpargptr ); p(id, fmt, tmpargptr );
} }
if (pLogStatus[id] & 2) { if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) { if (pLogStatus[id] & 8) {
fprintf(stderr, "[%s] %s", LogNames[id], prefix); fprintf(stderr, "[%s] ", LogNames[id]);
vfprintf( stderr, fmt, argptr ); vfprintf( stderr, fmt, argptr );
} } else {
else { fprintf(stdout, "[%s] ", LogNames[id]);
fprintf(stdout, "[%s] %s", LogNames[id], prefix);
vfprintf( stdout, fmt, argptr ); vfprintf( stdout, fmt, argptr );
} }
} }
va_end(argptr); va_end(argptr);
if (dofile) if (dofile) {
fprintf(fp[id], "\n"); fprintf(fp[id], "\n");
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8)
fprintf(stderr, "\n");
else
fprintf(stdout, "\n");
} }
if(dofile) if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
fprintf(stderr, "\n");
fflush(stderr);
} else {
fprintf(stdout, "\n");
fflush(stdout);
}
}
if (dofile) {
fflush(fp[id]); fflush(fp[id]);
}
return true; return true;
} }
bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { //write with Prefix and a VA_list
bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr)
{
if (!logFileValid) { if (!logFileValid) {
return false; return false;
} }
@ -258,30 +193,92 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
if (pLogStatus[id] & 1) { if (pLogStatus[id] & 1) {
dofile = open(id); dofile = open(id);
} }
if (!(dofile || pLogStatus[id] & 2)) if (!(dofile || pLogStatus[id] & 2)) {
return false; return false;
}
LockMutex lock(&MLog[id]); LockMutex lock(&MLog[id]);
if (!logFileValid) if (!logFileValid) {
return false; //check again for threading race reasons (to avoid two mutexes) return false; //check again for threading race reasons (to avoid two mutexes)
}
time_t aclock; time_t aclock;
struct tm *newtime; struct tm *newtime;
time( &aclock ); /* Get time in seconds */ time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */ newtime = localtime( &aclock ); /* Convert time to struct */
va_list tmpargptr;
if (dofile) {
#ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
#else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
#endif
va_copy(tmpargptr, argptr);
vfprintf( fp[id], fmt, tmpargptr );
}
if (logCallbackPva[id]) {
msgCallbackPva p = logCallbackPva[id];
va_copy(tmpargptr, argptr);
p(id, prefix, fmt, tmpargptr );
}
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
fprintf(stderr, "[%s] %s", LogNames[id], prefix);
vfprintf( stderr, fmt, argptr );
} else {
fprintf(stdout, "[%s] %s", LogNames[id], prefix);
vfprintf( stdout, fmt, argptr );
}
}
va_end(argptr);
if (dofile) {
fprintf(fp[id], "\n");
}
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
fprintf(stderr, "\n");
} else {
fprintf(stdout, "\n");
}
}
if (dofile) {
fflush(fp[id]);
}
return true;
}
bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count)
{
if (!logFileValid) {
return false;
}
if (id >= MaxLogID) {
return false;
}
bool dofile = false;
if (pLogStatus[id] & 1) {
dofile = open(id);
}
if (!(dofile || pLogStatus[id] & 2)) {
return false;
}
LockMutex lock(&MLog[id]);
if (!logFileValid) {
return false; //check again for threading race reasons (to avoid two mutexes)
}
time_t aclock;
struct tm *newtime;
time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */
if (dofile) if (dofile)
#ifndef NO_PIDLOG #ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#else #else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#endif #endif
if (dofile) { if (dofile) {
fwrite(buf, size, count, fp[id]); fwrite(buf, size, count, fp[id]);
fprintf(fp[id], "\n"); fprintf(fp[id], "\n");
} }
if(logCallbackBuf[id]) { if (logCallbackBuf[id]) {
msgCallbackBuf p = logCallbackBuf[id]; msgCallbackBuf p = logCallbackBuf[id];
p(id, buf, size, count); p(id, buf, size, count);
} }
@ -296,12 +293,14 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
fprintf(stdout, "\n"); fprintf(stdout, "\n");
} }
} }
if(dofile) if (dofile) {
fflush(fp[id]); fflush(fp[id]);
}
return true; return true;
} }
bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...)
{
va_list argptr, tmpargptr; va_list argptr, tmpargptr;
va_start(argptr, fmt); va_start(argptr, fmt);
if (dofile) { if (dofile) {
@ -309,132 +308,146 @@ bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
vfprintf( fp[id], fmt, tmpargptr ); vfprintf( fp[id], fmt, tmpargptr );
} }
if (pLogStatus[id] & 2) { if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) if (pLogStatus[id] & 8) {
vfprintf( stderr, fmt, argptr ); vfprintf( stderr, fmt, argptr );
else } else {
vfprintf( stdout, fmt, argptr ); vfprintf( stdout, fmt, argptr );
}
} }
va_end(argptr); va_end(argptr);
return true; return true;
}; };
bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) { bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip)
{
if (!logFileValid) { if (!logFileValid) {
#if EQDEBUG >= 10 #if EQDEBUG >= 10
std::cerr << "Error: Dump() from null pointer" << std::endl; std::cerr << "Error: Dump() from null pointer" << std::endl;
#endif #endif
return false; return false;
} }
if (size == 0) if (size == 0) {
return true; return true;
if (!LogFile) }
if (!LogFile) {
return false; return false;
if (id >= MaxLogID) }
if (id >= MaxLogID) {
return false; return false;
}
bool dofile = false; bool dofile = false;
if (pLogStatus[id] & 1) { if (pLogStatus[id] & 1) {
dofile = open(id); dofile = open(id);
} }
if (!(dofile || pLogStatus[id] & 2)) if (!(dofile || pLogStatus[id] & 2)) {
return false; return false;
}
LockMutex lock(&MLog[id]); LockMutex lock(&MLog[id]);
if (!logFileValid) if (!logFileValid) {
return false; //check again for threading race reasons (to avoid two mutexes) return false; //check again for threading race reasons (to avoid two mutexes)
}
write(id, "Dumping Packet: %i", size); write(id, "Dumping Packet: %i", size);
// Output as HEX // Output as HEX
int beginningOfLineOffset = 0; int beginningOfLineOffset = 0;
uint32 indexInData; uint32 indexInData;
std::string asciiOutput; std::string asciiOutput;
for (indexInData = skip; indexInData < size; indexInData++) {
for(indexInData=skip; indexInData<size; indexInData++) { if ((indexInData - skip) % cols == 0) {
if ((indexInData-skip)%cols==0) { if (indexInData != skip) {
if (indexInData != skip)
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str()); writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
writeNTS(id, dofile, "%4i: ", indexInData-skip); }
writeNTS(id, dofile, "%4i: ", indexInData - skip);
asciiOutput.clear(); asciiOutput.clear();
beginningOfLineOffset = 0; beginningOfLineOffset = 0;
} } else if ((indexInData - skip) % (cols / 2) == 0) {
else if ((indexInData-skip)%(cols/2) == 0) {
writeNTS(id, dofile, "- "); writeNTS(id, dofile, "- ");
} }
writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]); writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]);
if (data[indexInData] >= 32 && data[indexInData] < 127) {
if (data[indexInData] >= 32 && data[indexInData] < 127)
{
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx // According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
// Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long // Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long
// version. // version.
asciiOutput.append(std::to_string((long long)data[indexInData])); asciiOutput.append(std::to_string((long long)data[indexInData]));
} } else {
else
{
asciiOutput.append("."); asciiOutput.append(".");
} }
} }
uint32 k = ((indexInData-skip)-1)%cols; uint32 k = ((indexInData - skip) - 1) % cols;
if (k < 8) if (k < 8) {
writeNTS(id, dofile, " "); writeNTS(id, dofile, " ");
for (uint32 h = k+1; h < cols; h++) { }
for (uint32 h = k + 1; h < cols; h++) {
writeNTS(id, dofile, " "); writeNTS(id, dofile, " ");
} }
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str()); writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
if (dofile) if (dofile) {
fflush(fp[id]); fflush(fp[id]);
}
return true; return true;
} }
void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) { void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc)
if (!logFileValid) {
if (!logFileValid) {
return; return;
}
if (id >= MaxLogID) { if (id >= MaxLogID) {
return; return;
} }
logCallbackFmt[id] = proc; logCallbackFmt[id] = proc;
} }
void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) { void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc)
if (!logFileValid) {
if (!logFileValid) {
return; return;
}
if (id >= MaxLogID) { if (id >= MaxLogID) {
return; return;
} }
logCallbackBuf[id] = proc; logCallbackBuf[id] = proc;
} }
void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) { void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc)
if (!logFileValid) {
if (!logFileValid) {
return; return;
}
if (id >= MaxLogID) { if (id >= MaxLogID) {
return; return;
} }
logCallbackPva[id] = proc; logCallbackPva[id] = proc;
} }
void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) { void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc)
if (!logFileValid) {
if (!logFileValid) {
return; return;
}
int r; int r;
for(r = Status; r < MaxLogID; r++) { for (r = Status; r < MaxLogID; r++) {
SetCallback((LogIDs)r, proc); SetCallback((LogIDs)r, proc);
} }
} }
void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc) { void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc)
if (!logFileValid) {
if (!logFileValid) {
return; return;
}
int r; int r;
for(r = Status; r < MaxLogID; r++) { for (r = Status; r < MaxLogID; r++) {
SetCallback((LogIDs)r, proc); SetCallback((LogIDs)r, proc);
} }
} }
void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) { void EQEMuLog::SetAllCallbacks(msgCallbackPva proc)
if (!logFileValid) {
if (!logFileValid) {
return; return;
}
int r; int r;
for(r = Status; r < MaxLogID; r++) { for (r = Status; r < MaxLogID; r++) {
SetCallback((LogIDs)r, proc); SetCallback((LogIDs)r, proc);
} }
} }