From f880fc6ee9d398bb83b83dcf04a22e26560b4313 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 10 Sep 2006 04:52:43 +0000 Subject: [PATCH] added request am44229 - more error log info --- amxmodx/amxxlog.cpp | 30 ++++++++++++++++++++++-------- amxmodx/amxxlog.h | 1 + 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/amxmodx/amxxlog.cpp b/amxmodx/amxxlog.cpp index 2048974b..b90b2bd3 100755 --- a/amxmodx/amxxlog.cpp +++ b/amxmodx/amxxlog.cpp @@ -49,6 +49,7 @@ CLog::CLog() m_LogType = 0; m_LogFile.clear(); m_FoundError = false; + m_LoggedErrMap = false; } CLog::~CLog() @@ -147,17 +148,17 @@ void CLog::MapChange() print_srvconsole("[AMXX] Invalid amxx_logging value; setting back to 1..."); } + m_LoggedErrMap = false; + if (m_LogType == 2) { // create new logfile CreateNewFile(); - } - else if (m_LogType == 1) - { + } else if (m_LogType == 1) { Log("-------- Mapchange to %s --------", STRING(gpGlobals->mapname)); - } - else + } else { return; + } } void CLog::Log(const char *fmt, ...) @@ -215,9 +216,7 @@ void CLog::Log(const char *fmt, ...) // print on server console print_srvconsole("L %s: %s\n", date, msg); - } - else if (m_LogType == 3) - { + } else if (m_LogType == 3) { // build message static char msg_[3072]; va_list arglst; @@ -233,7 +232,9 @@ void CLog::LogError(const char *fmt, ...) static char file[256]; if (m_FoundError) + { return; + } // get time time_t td; @@ -257,6 +258,19 @@ void CLog::LogError(const char *fmt, ...) if (pF) { + if (!m_LoggedErrMap) + { + fprintf(pF, "L %s: Start of error session.\n", date); + if (m_LogType == 1) + { + fprintf(pF, "L %s: Info (map \"%s\") (logfile \"L%02d%02d.log\")\n", date, STRING(gpGlobals->mapname), curTime->tm_mon + 1, curTime->tm_mday); + } else if (m_LogType == 2) { + fprintf(pF, "L %s: Info (map \"%s\") (logfile \"%s\")\n", date, STRING(gpGlobals->mapname), m_LogFile.c_str()); + } else if (m_LogType == 3) { + fprintf(pF, "L %s: Info (map \"%s\") (logfile \"hl\")\n", date, STRING(gpGlobals->mapname)); + } + m_LoggedErrMap = true; + } fprintf(pF, "L %s: %s\n", date, msg); fclose(pF); } else { diff --git a/amxmodx/amxxlog.h b/amxmodx/amxxlog.h index 655da912..a9db353f 100755 --- a/amxmodx/amxxlog.h +++ b/amxmodx/amxxlog.h @@ -37,6 +37,7 @@ private: String m_LogFile; int m_LogType; bool m_FoundError; + bool m_LoggedErrMap; void GetLastFile(int &outMonth, int &outDay, String &outFilename); void UseFile(const String &fileName);