Example #1
0
File: XT.cpp Project: robessog/OBS
//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();
}
Example #2
0
void __cdecl OSDebugOutva(const TCHAR *format, va_list argptr)
{
    /*TCHAR blah[4096];
    vtsprintf_s(blah, 4095, format, argptr);*/

    String strDebug = FormattedStringva(format, argptr);

    OutputDebugString(strDebug);
}
Example #3
0
File: XT.cpp Project: robessog/OBS
void __cdecl Logva(const TCHAR *format, va_list argptr)
{
    if(!format) return;

    String strCurTime = CurrentTimeString();
    strCurTime << TEXT(": ");
    String strOut = strCurTime;
    strOut << FormattedStringva(format, argptr);

    strOut.FindReplace(TEXT("\n"), String() << TEXT("\n") << strCurTime);

    OpenLogFile();
    LogFile.WriteAsUTF8(strOut, strOut.Length());
    LogFile.WriteAsUTF8(TEXT("\r\n"));
    CloseLogFile();
}
__declspec(noreturn) void __cdecl DumpError(const TCHAR *format, ...)
{
    va_list arglist;

    va_start(arglist, format);

    String strOut(L"\r\nError: ");
    strOut << FormattedStringva(format, arglist);

    OpenLogFile();
    LogFile.WriteAsUTF8(strOut);
    LogFile.WriteStr(TEXT("\r\n"));
    CloseLogFile();

    OSMessageBoxva(format, arglist);

    OSRaiseException(0xDEAD0B5);
}
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);
}