JD2022-TU1/main/extern/Raki/Source/RakiTests/_Win32/System/RakiDebug.cpp

52 lines
1.1 KiB
C++

#include "Precompiled.h"
#include "RakiEngine/System/RakiThread.h"
//#define RAKI_DEBUG_SIMPLE_OUTPUT_WITHOUT_TIME
namespace raki
{
void Debug::output( const char * _text, ...)
{
char formattedText[0x200];
va_list args ;
va_start( args, _text );
vsprintf_s( formattedText, _text, args );
va_end (args) ;
// show time
char formattedTextWithTime[0x200];
#if defined ( RAKI_DEBUG_SIMPLE_OUTPUT_WITHOUT_TIME )
sprintf_s( formattedTextWithTime, 0x200, "%s\n", formattedText);
#else
sprintf_s( formattedTextWithTime, 0x200, "(%.3f) (thread 0x%x) %s\n", Time::getTime(), GetCurrentThreadId(), formattedText);
#endif
OutputDebugStringA( formattedTextWithTime );
}
void Debug::debugBreak( const char * _path, const int _line )
{
output( "RAKI ASSERT in %s (%d)", _path, _line );
::__debugbreak();
}
void Debug::debugBreakWithMessage( const char * _path, const int _line, const char* _errMsg )
{
output( "RAKI ASSERT <%s> in %s (%d)", _errMsg, _path, _line );
::__debugbreak();
}
}