The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. namespace juce
  18. {
  19. Logger::Logger() {}
  20. Logger::~Logger()
  21. {
  22. // You're deleting this logger while it's still being used!
  23. // Always call Logger::setCurrentLogger (nullptr) before deleting the active logger.
  24. jassert (currentLogger != this);
  25. }
  26. Logger* Logger::currentLogger = nullptr;
  27. void Logger::setCurrentLogger (Logger* const newLogger) noexcept { currentLogger = newLogger; }
  28. Logger* Logger::getCurrentLogger() noexcept { return currentLogger; }
  29. void Logger::writeToLog (const String& message)
  30. {
  31. if (currentLogger != nullptr)
  32. currentLogger->logMessage (message);
  33. else
  34. outputDebugString (message);
  35. }
  36. #if JUCE_LOG_ASSERTIONS || JUCE_DEBUG
  37. void JUCE_API JUCE_CALLTYPE logAssertion (const char* const filename, const int lineNum) noexcept
  38. {
  39. String m ("JUCE Assertion failure in ");
  40. m << File::createFileWithoutCheckingPath (filename).getFileName() << ':' << lineNum;
  41. #if JUCE_LOG_ASSERTIONS
  42. Logger::writeToLog (m);
  43. #else
  44. DBG (m);
  45. #endif
  46. }
  47. #endif
  48. } // namespace juce