CEGUILogger.h

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

Generated on Sun Nov 5 14:35:28 2006 for Crazy Eddies GUI System by  doxygen 1.4.7