Blindly add a few stuff from VST
[juce-lv2.git] / juce / source / src / core / juce_Logger.cpp
blob4a68e2814c6fae0463cd180e4f4b9c1fff0fffbc
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #include "juce_StandardHeader.h"
28 BEGIN_JUCE_NAMESPACE
30 #include "juce_Logger.h"
33 //==============================================================================
34 Logger::Logger()
38 Logger::~Logger()
42 //==============================================================================
43 Logger* Logger::currentLogger = nullptr;
45 void Logger::setCurrentLogger (Logger* const newLogger,
46 const bool deleteOldLogger)
48 Logger* const oldLogger = currentLogger;
49 currentLogger = newLogger;
51 if (deleteOldLogger)
52 delete oldLogger;
55 void Logger::writeToLog (const String& message)
57 if (currentLogger != nullptr)
58 currentLogger->logMessage (message);
59 else
60 outputDebugString (message);
63 #if JUCE_LOG_ASSERTIONS
64 void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) noexcept
66 String m ("JUCE Assertion failure in ");
67 m << filename << ", line " << lineNum;
69 Logger::writeToLog (m);
71 #endif
73 END_JUCE_NAMESPACE