Skip to content

Commit

Permalink
Merge pull request #459 from emoose/err-log
Browse files Browse the repository at this point in the history
ConsoleWnd: write game log msgs into log file, always log error msgs
  • Loading branch information
nipkownix committed Mar 3, 2023
2 parents d24af5e + a4b5013 commit 0821451
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions dllmain/ConsoleWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,12 @@ void __cdecl OSReport_hook(const char* msg, ...)
buffer[strlen(buffer) - 1] = '\0';
}

spd::log()->info("OSReport: {}", buffer);
con.gameLog("OSReport: %s", buffer);
}

void OSPanic_nullsub_hook(const char* file, int line, const char* message, ...)
{
if (!re4t::cfg->bShowGameOutput)
return;

va_list args;
char buffer[1024];

Expand All @@ -246,14 +244,12 @@ void OSPanic_nullsub_hook(const char* file, int line, const char* message, ...)
buffer[strlen(buffer) - 1] = '\0';
}

spd::log()->error("OSPanic: File: {}, Line: {}, Message: {}", file, line, buffer);
con.gameLog("OSPanic: File: %s, Line: %d, Message: %s", file, line, buffer);
}

void cLog__err_nullsubver_hook(uint32_t flag, uint32_t errId, char* mes, ...)
{
if (!re4t::cfg->bShowGameOutput)
return;

va_list args;
char buffer[1024];

Expand All @@ -268,14 +264,12 @@ void cLog__err_nullsubver_hook(uint32_t flag, uint32_t errId, char* mes, ...)
buffer[strlen(buffer) - 1] = '\0';
}

spd::log()->error("cLog::err: Flag: {}, errId: {}, Message: {}", flag, errId, buffer);
con.gameLog("cLog::err: Flag: %d, errId: %d, Message: %s", flag, errId, buffer);
}

void cLog__err_1_hook(int a1, int a2, const char* message, ...)
{
if (!re4t::cfg->bShowGameOutput)
return;

va_list args;
char buffer[1024];

Expand All @@ -290,6 +284,7 @@ void cLog__err_1_hook(int a1, int a2, const char* message, ...)
buffer[strlen(buffer) - 1] = '\0';
}

spd::log()->error("cLog::err_1: {}", buffer);
con.gameLog("cLog::err_1: %s", buffer);
}

Expand Down

0 comments on commit 0821451

Please sign in to comment.