OpenShot Library | libopenshot-audio 0.2.0
juce_Logger.h
1
2/** @weakgroup juce_core-logging
3 * @{
4 */
5/*
6 ==============================================================================
7
8 This file is part of the JUCE library.
9 Copyright (c) 2017 - ROLI Ltd.
10
11 JUCE is an open source library subject to commercial or open-source
12 licensing.
13
14 The code included in this file is provided under the terms of the ISC license
15 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16 To use, copy, modify, and/or distribute this software for any purpose with or
17 without fee is hereby granted provided that the above copyright notice and
18 this permission notice appear in all copies.
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27namespace juce
28{
29
30//==============================================================================
31/**
32 Acts as an application-wide logging class.
33
34 A subclass of Logger can be created and passed into the Logger::setCurrentLogger
35 method and this will then be used by all calls to writeToLog.
36
37 The logger class also contains methods for writing messages to the debugger's
38 output stream.
39
40 @see FileLogger
41
42 @tags{Core}
43*/
45{
46public:
47 //==============================================================================
48 /** Destructor. */
49 virtual ~Logger();
50
51 //==============================================================================
52 /** Sets the current logging class to use.
53
54 Note that the object passed in will not be owned or deleted by the logger, so
55 the caller must make sure that it is not deleted while still being used.
56 A null pointer can be passed-in to reset the system to the default logger.
57 */
58 static void JUCE_CALLTYPE setCurrentLogger (Logger* newLogger) noexcept;
59
60 /** Returns the current logger, or nullptr if no custom logger has been set. */
61 static Logger* JUCE_CALLTYPE getCurrentLogger() noexcept;
62
63 /** Writes a string to the current logger.
64
65 This will pass the string to the logger's logMessage() method if a logger
66 has been set.
67
68 @see logMessage
69 */
70 static void JUCE_CALLTYPE writeToLog (const String& message);
71
72
73 //==============================================================================
74 /** Writes a message to the standard error stream.
75
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).
78 */
79 static void JUCE_CALLTYPE outputDebugString (const String& text);
80
81
82protected:
83 //==============================================================================
84 Logger();
85
86 /** This is overloaded by subclasses to implement custom logging behaviour.
87 @see setCurrentLogger
88 */
89 virtual void logMessage (const String& message) = 0;
90
91private:
92 static Logger* currentLogger;
93};
94
95} // namespace juce
96
97/** @}*/
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:60
Acts as an application-wide logging class.
Definition juce_Logger.h:45
virtual void logMessage(const String &message)=0
This is overloaded by subclasses to implement custom logging behaviour.
static void JUCE_CALLTYPE outputDebugString(const String &text)
Writes a message to the standard error stream.
The JUCE String class!
Definition juce_String.h:43
#define JUCE_API
This macro is added to all JUCE public class declarations.