1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-18 00:54:19 +00:00

Minor change to assertion logging.

This commit is contained in:
jules 2013-03-21 16:12:00 +00:00
parent 810e73b2bc
commit 45bc723f0c
4 changed files with 12 additions and 9 deletions

View file

@ -45,12 +45,16 @@ void Logger::writeToLog (const String& message)
outputDebugString (message);
}
#if JUCE_LOG_ASSERTIONS
#if JUCE_LOG_ASSERTIONS || JUCE_DEBUG
void JUCE_API logAssertion (const char* const filename, const int lineNum) noexcept
{
String m ("JUCE Assertion failure in ");
m << File::createFileWithoutCheckingPath (filename).getFileName() << ':' << lineNum;
#if JUCE_LOG_ASSERTIONS
Logger::writeToLog (m);
#else
DBG (m);
#endif
}
#endif

View file

@ -36,7 +36,11 @@ ScopedAutoReleasePool::~ScopedAutoReleasePool()
//==============================================================================
void Logger::outputDebugString (const String& text)
{
std::cerr << text << std::endl;
// Would prefer to use std::cerr here, but avoiding it for
// the moment, due to clang JIT linkage problems.
fputs (text.toUTF8().getAddress(), stderr);
fputs ("\n", stderr);
fflush (stderr);
}
//==============================================================================

View file

@ -51,10 +51,8 @@
//==============================================================================
// Debugging and assertion macros
#if JUCE_LOG_ASSERTIONS
#if JUCE_LOG_ASSERTIONS || JUCE_DEBUG
#define juce_LogCurrentAssertion juce::logAssertion (__FILE__, __LINE__);
#elif JUCE_DEBUG
#define juce_LogCurrentAssertion std::cerr << "JUCE Assertion failure in " << __FILE__ << ", line " << __LINE__ << std::endl;
#else
#define juce_LogCurrentAssertion
#endif

View file

@ -156,10 +156,7 @@
namespace juce
{
extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger();
#if JUCE_LOG_ASSERTIONS
extern JUCE_API void logAssertion (const char* file, int line) noexcept;
#endif
extern JUCE_API void logAssertion (const char* file, int line) noexcept;
#include "../memory/juce_Memory.h"
#include "../maths/juce_MathsFunctions.h"