@@ -45,12 +45,16 @@ void Logger::writeToLog (const String& message) | |||||
outputDebugString (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 | void JUCE_API logAssertion (const char* const filename, const int lineNum) noexcept | ||||
{ | { | ||||
String m ("JUCE Assertion failure in "); | String m ("JUCE Assertion failure in "); | ||||
m << File::createFileWithoutCheckingPath (filename).getFileName() << ':' << lineNum; | m << File::createFileWithoutCheckingPath (filename).getFileName() << ':' << lineNum; | ||||
#if JUCE_LOG_ASSERTIONS | |||||
Logger::writeToLog (m); | Logger::writeToLog (m); | ||||
#else | |||||
DBG (m); | |||||
#endif | |||||
} | } | ||||
#endif | #endif |
@@ -36,7 +36,11 @@ ScopedAutoReleasePool::~ScopedAutoReleasePool() | |||||
//============================================================================== | //============================================================================== | ||||
void Logger::outputDebugString (const String& text) | 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); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -51,10 +51,8 @@ | |||||
//============================================================================== | //============================================================================== | ||||
// Debugging and assertion macros | // Debugging and assertion macros | ||||
#if JUCE_LOG_ASSERTIONS | |||||
#if JUCE_LOG_ASSERTIONS || JUCE_DEBUG | |||||
#define juce_LogCurrentAssertion juce::logAssertion (__FILE__, __LINE__); | #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 | #else | ||||
#define juce_LogCurrentAssertion | #define juce_LogCurrentAssertion | ||||
#endif | #endif | ||||
@@ -156,10 +156,7 @@ | |||||
namespace juce | namespace juce | ||||
{ | { | ||||
extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger(); | 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 "../memory/juce_Memory.h" | ||||
#include "../maths/juce_MathsFunctions.h" | #include "../maths/juce_MathsFunctions.h" | ||||