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 #ifndef __JUCE_LOGGER_JUCEHEADER__
27 #define __JUCE_LOGGER_JUCEHEADER__
29 #include "../text/juce_String.h"
32 //==============================================================================
34 Acts as an application-wide logging class.
36 A subclass of Logger can be created and passed into the Logger::setCurrentLogger
37 method and this will then be used by all calls to writeToLog.
39 The logger class also contains methods for writing messages to the debugger's
47 //==============================================================================
51 //==============================================================================
52 /** Sets the current logging class to use.
54 Note that the object passed in won't be deleted when no longer needed.
55 A null pointer can be passed-in to disable any logging.
57 If deleteOldLogger is set to true, the existing logger will be
58 deleted (if there is one).
60 static void JUCE_CALLTYPE
setCurrentLogger (Logger
* newLogger
,
61 bool deleteOldLogger
= false);
63 /** Writes a string to the current logger.
65 This will pass the string to the logger's logMessage() method if a logger
70 static void JUCE_CALLTYPE
writeToLog (const String
& message
);
73 //==============================================================================
74 /** Writes a message to the standard error stream.
76 This can be called directly, or by using the DBG() macro in
77 juce_PlatformDefs.h (which will avoid calling the method in non-debug builds).
79 static void JUCE_CALLTYPE
outputDebugString (const String
& text
);
83 //==============================================================================
86 /** This is overloaded by subclasses to implement custom logging behaviour.
90 virtual void logMessage (const String
& message
) = 0;
93 static Logger
* currentLogger
;
97 #endif // __JUCE_LOGGER_JUCEHEADER__