Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUILogger.h

Go to the documentation of this file.
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     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUILogger_h_
00027 #define _CEGUILogger_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIString.h"
00031 #include <fstream>
00032 
00033 #include "CEGUISingleton.h"
00034 
00035 
00036 #if defined(_MSC_VER)
00037 #       pragma warning(push)
00038 #       pragma warning(disable : 4275)
00039 #endif
00040 
00041 
00042 // Start of CEGUI namespace section
00043 namespace CEGUI
00044 {
00045 
00050 enum LoggingLevel
00051 {
00052         Errors,                 
00053         Standard,               
00054         Informative,    
00055         Insane,                 
00056 };
00057 
00062 class CEGUIBASE_API Logger : public Singleton <Logger>
00063 {
00064 public:
00079         Logger(const String& filename, bool append = false);
00080 
00084         ~Logger(void);
00085 
00086         
00094         static Logger&  getSingleton(void);
00095 
00096 
00107         void    setLoggingLevel(LoggingLevel level)             {d_level = level;}
00108 
00109 
00117         LoggingLevel    getLoggingLevel(void) const             {return d_level;}
00118 
00119 
00133         void    logEvent(const String& message, LoggingLevel level = Standard);
00134 
00135 protected:
00136         /*************************************************************************
00137                 Implementation Data
00138         *************************************************************************/
00139         LoggingLevel    d_level;                
00140         std::ofstream   d_ostream;              
00141 
00142 private:
00143         /*************************************************************************
00144                 Copy constructor and assignment usage is denied.
00145         *************************************************************************/
00146         Logger(const Logger& logger) {}
00147         Logger& operator=(const Logger& logger) {return *this;}
00148 
00149 };
00150 
00151 /*************************************************************************
00152         This macro is used for 'Insane' level logging so that those items are
00153         excluded from non-debug builds
00154 *************************************************************************/
00155 #if defined(DEBUG) || defined (_DEBUG)
00156 #       define CEGUI_LOGINSANE( message )
00157 #else
00158 #       define CEGUI_LOGINSANE( message ) CEGUI::Logger::getSingleton().logEvent((message), CEGUI::Insane);
00159 #endif
00160 
00161 } // End of  CEGUI namespace section
00162 
00163 #if defined(_MSC_VER)
00164 #       pragma warning(pop)
00165 #endif
00166 
00167 #endif  // end of guard _CEGUILogger_h_

Generated on Wed Feb 16 12:41:06 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1