When AMXX can't open the logfile it outputs an error rather than crashing

This commit is contained in:
Pavol Marko 2004-09-01 17:01:52 +00:00
parent 560cd184cc
commit 551d51ea42

View File

@ -181,9 +181,18 @@ void CLog::Log(const char *fmt, ...)
{
pF = fopen(build_pathname("%s/L%02d%02d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday), "a+");
}
if (pF)
{
fprintf(pF, "L %s: %s\n", date, msg);
fclose(pF);
}
else
{
ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", m_LogFile.c_str());
m_LogType = 0;
return;
}
// print on server console
print_srvconsole("L %s: %s\n", date, msg);
}