//note to self: do try not to rely on this too much. void __cdecl CrashError(const TCHAR *format, ...) { if(!format) return; va_list arglist; va_start(arglist, format); String strOut = FormattedStringva(format, arglist); OpenLogFile(); LogFile.WriteStr(TEXT("\r\nError: ")); LogFile.WriteAsUTF8(strOut); LogFile.WriteStr(TEXT("\r\n")); CloseLogFile(); OSMessageBoxva(format, arglist); #if defined(_DEBUG) && defined(_WIN32) if(bDebugBreak && OSDebuggerPresent()) ProgramBreak(); #endif CriticalExit(); }
void __cdecl AppWarning(const TCHAR *format, ...) { if(!format) return; va_list arglist; va_start(arglist, format); String strOut(L"Warning -- "); strOut << FormattedStringva(format, arglist); if(bLogStarted) { OpenLogFile(); LogFile.WriteAsUTF8(strOut, strOut.Length()); LogFile.WriteAsUTF8(TEXT("\r\n")); CloseLogFile(); } OSDebugOut(TEXT("Warning -- ")); OSDebugOutva(format, arglist); OSDebugOut(TEXT("\r\n")); //------------------------------------------------------ // NOTE: // If you're seeting this, you can safely continue running, but I recommend fixing whatever's causing this warning. // // The debug output window contains the warning that has occured. //------------------------------------------------------ #if defined(_DEBUG) && defined(_WIN32) if(bDebugBreak && OSDebuggerPresent()) { ProgramBreak(); } #endif StringLog.Append(strOut); }