diff --git a/common/debug.cpp b/common/debug.cpp index cd02b8005..d31eb54dc 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -252,83 +252,6 @@ bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list 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) - #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 - if (dofile) { - fwrite(buf, size, count, fp[id]); - fprintf(fp[id], "\n"); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "[%s] ", LogNames[id]); - fwrite(buf, size, count, stderr); - fprintf(stderr, "\n"); - } else { -#ifdef _WINDOWS - HANDLE console_handle; - console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - CONSOLE_FONT_INFOEX info = { 0 }; - info.cbSize = sizeof(info); - info.dwFontSize.Y = 12; // leave X as zero - info.FontWeight = FW_NORMAL; - wcscpy(info.FaceName, L"Lucida Console"); - SetCurrentConsoleFontEx(console_handle, NULL, &info); - - if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } -#endif - - fprintf(stdout, "[%s] ", LogNames[id]); - fwrite(buf, size, count, stdout); - fprintf(stdout, "\n"); - -#ifdef _WINDOWS - /* Always set back to white*/ - SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); -#endif - - - } - } - if (dofile) { - fflush(fp[id]); - } - return true; -} - bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { va_list argptr, tmpargptr; diff --git a/common/debug.h b/common/debug.h index 120b332de..8127d85cb 100644 --- a/common/debug.h +++ b/common/debug.h @@ -102,8 +102,6 @@ public: void SetCallback(LogIDs id, msgCallbackFmt proc); void SetCallback(LogIDs id, msgCallbackBuf proc); void SetCallback(LogIDs id, msgCallbackPva proc); - - bool writebuf(LogIDs id, const char *buf, uint8 size, uint32 count); bool write(LogIDs id, const char *fmt, ...); bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0);