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

FileLogger.h

00001 
00002 #ifndef __FILELOGGER_H_
00003 #define __FILELOGGER_H_
00004 /*
00005 Peon - Win32 Games Programming Library
00006 Copyright (C) 2002-2005 Erik Yuzwa
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Library General Public
00010 License as published by the Free Software Foundation; either
00011 version 2 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Library General Public License for more details.
00017 
00018 You should have received a copy of the GNU Library General Public
00019 License along with this library; if not, write to the Free
00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 Erik Yuzwa
00023 peon AT wazooinc DOT com
00024 */
00025 
00026 #include "peonstdafx.h"
00027 
00028 #include "ISingleton.h"
00029 
00030 
00040 #define PEON_LOG_INFO          0x0001
00041 #define PEON_LOG_DEBUG             0x0002
00042 #define PEON_LOG_ERROR         0x0004
00043 #define PEON_LOG_FATAL         0x0008
00044 
00045 
00046 namespace peon {
00047 
00060         class PEONMAIN_API FileLogger : public ISingleton<FileLogger>
00061         {
00062 
00063         protected:
00064                 
00066                 std::ofstream   m_log_file;
00067 
00069                 String                  m_strLogName;
00070         
00072                 int                             m_logging_level;
00073         
00074         protected:
00075 
00082                 void writeToLogStream(const String& strText);
00083 
00084                 
00085         public:
00086 
00091                 FileLogger( int log_flag = PEON_LOG_DEBUG );
00092 
00096                 ~FileLogger();
00097 
00113         static FileLogger& getSingleton(void);
00114 
00130         static FileLogger* getSingletonPtr(void);
00131 
00138                 bool openLogStream(const String& strName);
00139 
00146                 void closeLogStream(void);
00147 
00155                 void logInfo ( const String& strObject, const String& strText);
00156 
00164                 void logDebug(const String& strObject, const String& strText);
00165 
00173                 void logError(const String& strObject, const String& strText);
00174 
00182                 void logFatal( const String& strObject, const String& strText);
00183 
00184         
00185                 
00186         };
00187 }
00188 
00189 #endif

Generated on Thu Dec 1 01:55:40 2005 for Peon by  doxygen 1.4.1