Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 21/2/2004 00003 author: Paul D Turner 00004 00005 purpose: Defines interface for the Logger class 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject to 00016 * the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00025 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00026 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00027 * OTHER DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************/ 00029 #ifndef _CEGUILogger_h_ 00030 #define _CEGUILogger_h_ 00031 00032 #include "CEGUI/Base.h" 00033 #include "CEGUI/String.h" 00034 #include <fstream> 00035 #include <sstream> 00036 #include <vector> 00037 #include <utility> 00038 #include "CEGUI/Singleton.h" 00039 00040 00041 #if defined(_MSC_VER) 00042 # pragma warning(push) 00043 # pragma warning(disable : 4275) 00044 # pragma warning(disable : 4251) 00045 #endif 00046 00047 00048 // Start of CEGUI namespace section 00049 namespace CEGUI 00050 { 00051 00056 enum LoggingLevel 00057 { 00058 Errors, 00059 Warnings, 00060 Standard, 00061 Informative, 00062 Insane 00063 }; 00064 00072 class CEGUIEXPORT Logger : 00073 public Singleton<Logger>, 00074 public AllocatedObject<Logger> 00075 { 00076 public: 00081 Logger(void); 00082 00086 virtual ~Logger(void); 00087 00088 00099 void setLoggingLevel(LoggingLevel level) {d_level = level;} 00100 00101 00109 LoggingLevel getLoggingLevel(void) const {return d_level;} 00110 00111 00125 virtual void logEvent(const String& message, LoggingLevel level = Standard) = 0; 00126 00144 virtual void setLogFilename(const String& filename, bool append = false) = 0; 00145 00146 protected: 00147 LoggingLevel d_level; 00148 00149 private: 00150 /************************************************************************* 00151 Copy constructor and assignment usage is denied. 00152 *************************************************************************/ 00153 Logger(const Logger&) : Singleton <Logger>() {} 00154 Logger& operator=(const Logger&) {return *this;} 00155 00156 }; 00157 00158 /************************************************************************* 00159 This macro is used for 'Insane' level logging so that those items are 00160 excluded from non-debug builds 00161 *************************************************************************/ 00162 #if defined(DEBUG) || defined (_DEBUG) 00163 # define CEGUI_LOGINSANE( message ) CEGUI::Logger::getSingleton().logEvent((message), CEGUI::Insane); 00164 #else 00165 # define CEGUI_LOGINSANE( message ) (void)0 00166 #endif 00167 00168 } // End of CEGUI namespace section 00169 00170 #if defined(_MSC_VER) 00171 # pragma warning(pop) 00172 #endif 00173 00174 #endif // end of guard _CEGUILogger_h_