Crazy Eddie's GUI System  0.8.5
Logger.h
1 /***********************************************************************
2  created: 21/2/2004
3  author: Paul D Turner
4 
5  purpose: Defines interface for the Logger class
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUILogger_h_
30 #define _CEGUILogger_h_
31 
32 #include "CEGUI/Base.h"
33 #include "CEGUI/String.h"
34 #include <fstream>
35 #include <sstream>
36 #include <vector>
37 #include <utility>
38 #include "CEGUI/Singleton.h"
39 
40 
41 #if defined(_MSC_VER)
42 # pragma warning(push)
43 # pragma warning(disable : 4275)
44 # pragma warning(disable : 4251)
45 #endif
46 
47 
48 // Start of CEGUI namespace section
49 namespace CEGUI
50 {
51 
57 {
63 };
64 
72 class CEGUIEXPORT Logger :
73  public Singleton<Logger>,
74  public AllocatedObject<Logger>
75 {
76 public:
81  Logger(void);
82 
86  virtual ~Logger(void);
87 
88 
99  void setLoggingLevel(LoggingLevel level) {d_level = level;}
100 
101 
109  LoggingLevel getLoggingLevel(void) const {return d_level;}
110 
111 
125  virtual void logEvent(const String& message, LoggingLevel level = Standard) = 0;
126 
144  virtual void setLogFilename(const String& filename, bool append = false) = 0;
145 
146 protected:
148 
149 private:
150  /*************************************************************************
151  Copy constructor and assignment usage is denied.
152  *************************************************************************/
153  Logger(const Logger&) : Singleton <Logger>() {}
154  Logger& operator=(const Logger&) {return *this;}
155 
156 };
157 
158 /*************************************************************************
159  This macro is used for 'Insane' level logging so that those items are
160  excluded from non-debug builds
161 *************************************************************************/
162 #if defined(DEBUG) || defined (_DEBUG)
163 # define CEGUI_LOGINSANE( message ) CEGUI::Logger::getSingleton().logEvent((message), CEGUI::Insane);
164 #else
165 # define CEGUI_LOGINSANE( message ) (void)0
166 #endif
167 
168 } // End of CEGUI namespace section
169 
170 #if defined(_MSC_VER)
171 # pragma warning(pop)
172 #endif
173 
174 #endif // end of guard _CEGUILogger_h_
Mostly everything gets logged (use for heavy tracing only, log WILL be big).
Definition: Logger.h:62
Definition: MemoryAllocatedObject.h:109
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
LoggingLevel getLoggingLevel(void) const
return the current logging level setting
Definition: Logger.h:109
Only actual error conditions will be logged.
Definition: Logger.h:58
Abstract class that defines the interface of a logger object for the GUI system. The default impleme...
Definition: Logger.h:72
Useful tracing (object creations etc) information will be logged.
Definition: Logger.h:61
LoggingLevel d_level
Holds current logging level.
Definition: Logger.h:147
Definition: Singleton.h:55
void setLoggingLevel(LoggingLevel level)
Set the level of logging information that will get out to the log file.
Definition: Logger.h:99
LoggingLevel
Enumeration of logging levels.
Definition: Logger.h:56
Basic events will be logged (default level).
Definition: Logger.h:60
Warnings will be logged as well.
Definition: Logger.h:59
String class used within the GUI system.
Definition: String.h:62