Blindly add a few stuff from VST
[juce-lv2.git] / juce / source / src / core / juce_Logger.h
blob6bec018bcdc894efc2bd56f721b49b58eadae7b8
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 #ifndef __JUCE_LOGGER_JUCEHEADER__
27 #define __JUCE_LOGGER_JUCEHEADER__
29 #include "../text/juce_String.h"
32 //==============================================================================
33 /**
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
40 output stream.
42 @see FileLogger
44 class JUCE_API Logger
46 public:
47 //==============================================================================
48 /** Destructor. */
49 virtual ~Logger();
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
66 has been set.
68 @see logMessage
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);
82 protected:
83 //==============================================================================
84 Logger();
86 /** This is overloaded by subclasses to implement custom logging behaviour.
88 @see setCurrentLogger
90 virtual void logMessage (const String& message) = 0;
92 private:
93 static Logger* currentLogger;
97 #endif // __JUCE_LOGGER_JUCEHEADER__