void VARARGS InternalLogNANDiagnosticMessage(const TCHAR* FormattedMsg, ...) { const int32 TempStrSize = 4096; TCHAR TempStr[TempStrSize]; GET_VARARGS(TempStr, TempStrSize, TempStrSize - 1, FormattedMsg, FormattedMsg); UE_LOG(LogCore, Error, TempStr); }
// // Failed assertion handler. //warning: May be called at library startup time. // void VARARGS FDebug::AssertFailed( const ANSICHAR* Expr, const ANSICHAR* File, int32 Line, const TCHAR* Format/*=TEXT("")*/, ... ) { #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) // Walk the script stack, if any if( GScriptStack.Num() > 0 ) { FString ScriptStack = TEXT( "\n\nScript Stack:\n" ); while( GScriptStack.Num() ) { ScriptStack += GScriptStack.Pop().GetStackDescription() + TEXT( "\n" ); } UE_LOG( LogOutputDevice, Warning, TEXT( "%s" ), *ScriptStack ); } #endif // Ignore this assert if we're already forcibly shutting down because of a critical error. if( !GIsCriticalError ) { TCHAR DescriptionString[4096]; GET_VARARGS( DescriptionString, ARRAY_COUNT( DescriptionString ), ARRAY_COUNT( DescriptionString ) - 1, Format, Format ); TCHAR ErrorString[MAX_SPRINTF]; FCString::Sprintf( ErrorString, TEXT( "Assertion failed: %s" ), ANSI_TO_TCHAR( Expr ) ); StaticFailDebug( ErrorString, File, Line, DescriptionString ); GError->Logf( TEXT( "Assertion failed: %s" ) FILE_LINE_DESC TEXT( "\n%s\n" ), ErrorString, ANSI_TO_TCHAR( File ), Line, DescriptionString ); } }
void VARARGS FError::LowLevelFatal(const ANSICHAR* File, int32 Line, const TCHAR* Format, ... ) { TCHAR DescriptionString[4096]; GET_VARARGS( DescriptionString, ARRAY_COUNT(DescriptionString), ARRAY_COUNT(DescriptionString)-1, Format, Format ); StaticFailDebug(TEXT("LowLevelFatalError"),File,Line,DescriptionString); GError->Log(DescriptionString); }
// // Throw a string exception with a message. // VARARG_BODY( void VARARGS, FError::Throwf, const TCHAR*, VARARG_NONE ) { static TCHAR TempStr[4096]; GET_VARARGS( TempStr, ARRAY_COUNT(TempStr), ARRAY_COUNT(TempStr)-1, Fmt, Fmt ); #if HACK_HEADER_GENERATOR && !PLATFORM_EXCEPTIONS_DISABLED throw( TempStr ); #else UE_LOG(LogOutputDevice, Error, TEXT("THROW: %s"), TempStr); #endif }
VARARG_BODY( bool, FWindowsNativeFeedbackContext::YesNof, const TCHAR*, VARARG_NONE ) { TCHAR TempStr[4096]; GET_VARARGS( TempStr, ARRAY_COUNT(TempStr), ARRAY_COUNT(TempStr)-1, Fmt, Fmt ); if( ( GIsClient || GIsEditor ) && ( ( GIsSilent != true ) && ( FApp::IsUnattended() != true ) ) ) { return( ::MessageBox( NULL, TempStr, *NSLOCTEXT("Core", "Question", "Question").ToString(), MB_YESNO|MB_TASKMODAL ) == IDYES); } else { return false; } }
bool VARARGS FDebug::EnsureNotFalseFormatted( bool bExpressionResult, const ANSICHAR* Expr, const ANSICHAR* File, int32 Line, const TCHAR* FormattedMsg, ... ) { const int32 TempStrSize = 4096; TCHAR TempStr[ TempStrSize ]; GET_VARARGS( TempStr, TempStrSize, TempStrSize - 1, FormattedMsg, FormattedMsg ); if( bExpressionResult == 0 ) { EnsureFailed( Expr, File, Line, TempStr ); } return bExpressionResult; }
//////////////////////////////////////////////////////////////////////// /// /// @fn void __cdecl appFailAssertFunc( const char* Expr, const char* File, int Line, const char* Format/*=""*/, ... ) /// /// /*Description*/ /// /// @param[in] const char * Expr /// @param[in] const char * File /// @param[in] int Line /// @param[in] const char * Format /// @param[in] ... /// /// @return void __cdecl /// //////////////////////////////////////////////////////////////////////// void __cdecl appFailAssertFunc( const char* Expr, const char* File, int Line, const char* Format/*=""*/, ... ) { char assertIDText[2048]; sprintf_s(assertIDText,"[File:%s] [Line: %i]",File,Line); char AssertMsg[2048]; GET_VARARGS( AssertMsg, ARRAY_COUNT(AssertMsg), ARRAY_COUNT(AssertMsg)-1, Format, Format ); std::string displayMessage; displayMessage += assertIDText; displayMessage += "\n"; displayMessage += Expr; displayMessage += "\n"; displayMessage += AssertMsg; static std::vector<int> IgnoredAssertTrackingList; int hash = GenerateHashCode(assertIDText); bool bIsAssertIgnored = find(IgnoredAssertTrackingList.begin(),IgnoredAssertTrackingList.end(),hash) != IgnoredAssertTrackingList.end(); if(!bIsAssertIgnored) { appDebugBreak(); } if(!bIsAssertIgnored) { AssertHandleMode HandleMode = DisplayAssertMessage( displayMessage.c_str() ); switch( HandleMode ) { case ASSERT_IgnoreAll: IgnoredAssertTrackingList.push_back( hash ); // fall through case ASSERT_Ignore: bIsAssertIgnored = true; break; case ASSERT_Break: // fall through default: break; } } }