From b9c83aa4a280b0e7a3b2af4fa48b4872ba36ee22 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 4 Oct 2004 05:50:28 +0000 Subject: [PATCH] Reworked SDK LogError() to include module names improved debugging output --- amxmodx/modules.cpp | 18 ++++++++++-------- amxmodx/msvc/amxmodx_mm.vcproj | 2 +- amxmodx/sdk/amxxmodule.cpp | 16 ++++++++++++++-- amxmodx/sdk/amxxmodule.h | 4 ++-- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index 9b1d9854..dcb0c805 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -1190,7 +1190,8 @@ void LogError(AMX *amx, int err, const char *fmt, ...) if (!dbg || !(dbg->tail)) { GenericError(amx, err, amx->curline, buf, NULL); - AMXXLOG_Log("[AMXX] %s %s", buf, vbuf); + AMXXLOG_Log("[AMXX] %s", buf); + AMXXLOG_Log("%s", vbuf); } else { AMX_TRACE *t = dbg->tail; AMX_DEBUGCALL tracer = (AMX_DEBUGCALL)(amx->userdata[1]); @@ -1198,19 +1199,20 @@ void LogError(AMX *amx, int err, const char *fmt, ...) cell line = amx->curline; cell file = amx->curfile; int i = 0; - if (file >= dbg->numFiles || file < 0) - { - GenericError(amx, err, line, buf, NULL); - } else { - GenericError(amx, err, line, buf, dbg->files[file]); - } + GenericError(amx, err, line, buf, NULL); AMXXLOG_Log("[AMXX] %s", buf); if (*vbuf) { - AMXXLOG_Log("[AMXX] %s", vbuf); + AMXXLOG_Log("%s", vbuf); } AMXXLOG_Log("[AMXX] Debug Trace =>"); //log the error right away + if (file >= dbg->numFiles || file < 0) + { + AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, g_plugins.findPluginFast(amx)->getName()); + } else { + AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, dbg->files[file]); + } while (t != NULL) { line = t->line; diff --git a/amxmodx/msvc/amxmodx_mm.vcproj b/amxmodx/msvc/amxmodx_mm.vcproj index ddca6bab..7aae892a 100755 --- a/amxmodx/msvc/amxmodx_mm.vcproj +++ b/amxmodx/msvc/amxmodx_mm.vcproj @@ -316,7 +316,7 @@