Browse Source

Minor change to assertion logging.

tags/2021-05-28
jules 12 years ago
parent
commit
45bc723f0c
4 changed files with 12 additions and 9 deletions
  1. +5
    -1
      modules/juce_core/logging/juce_Logger.cpp
  2. +5
    -1
      modules/juce_core/native/juce_mac_SystemStats.mm
  3. +1
    -3
      modules/juce_core/system/juce_PlatformDefs.h
  4. +1
    -4
      modules/juce_core/system/juce_StandardHeader.h

+ 5
- 1
modules/juce_core/logging/juce_Logger.cpp View File

@@ -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

+ 5
- 1
modules/juce_core/native/juce_mac_SystemStats.mm View File

@@ -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);
} }
//============================================================================== //==============================================================================


+ 1
- 3
modules/juce_core/system/juce_PlatformDefs.h View File

@@ -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


+ 1
- 4
modules/juce_core/system/juce_StandardHeader.h View File

@@ -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"


Loading…
Cancel
Save