D:/WorkDir/SugoiProjects/SugoiTools/include/SugoiTools/loggingManager.h

00001 /* LICENSE_BEGIN
00002 SutoiTools library supply support for debugging, testing and 
00003 setting good bases for you application. It is part of the 
00004 SugoiEngine project.
00005 Copyright (C) 2006 Allusse Yannick (yannick dot allusse at laposte dot net)
00006 
00007 
00008 This program is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either version 2
00011 of the License, or (at your option) any later version.
00012 
00013 This program 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
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021 LICENSE_END
00022 */
00023 
00024 /* \file LoggingManager.cpp
00025  * \author Yannick Allusse
00026 */
00027 #ifndef SG_TLS_LOGMNGR_H
00028 #define SG_TLS_LOGMNGR_H
00029 
00030 #include "SugoiTools\config.h"
00031 #include "SugoiTools\cl_template_manager.h"
00032 #include <iostream>
00033 
00034 
00035 namespace SGE{
00036 
00040 class RunTimeEvent : public CL_BASE_OBJ<int>
00041 {
00042 public:
00043           enum Type
00044           {                   
00045                     TpException,
00046                     TpError,
00047                     TpWarning,
00048                     TpNotice,
00049                     TpToDo,
00050                     TpUnknown
00051           };
00052 
00053           RunTimeEvent(const int _ID);
00054           RunTimeEvent(char * _File, int _Line, RunTimeEvent::Type _type, std::ostringstream _message);
00055           ~RunTimeEvent();
00056 
00057           const std::string & GetFileName()const;
00058           int GetLine()const;
00059           const std::string & GetMsg()const;
00060           const time_t & GetTime()const;
00061           Type GetType()const;
00062 
00063           std::ostringstream & operator << (std::ostringstream & _stream);
00064 
00065 protected:
00066           std::string m_fileName;
00067           int                           m_line;
00068           std::string m_message;
00069           time_t              m_time;
00070           Type                m_type;
00071           static              int       m_eventLastID;
00072 };
00073 
00074 class LogMngr
00075 {
00076 public:
00077           static 
00078                     LogMngr * GetInstance();
00079           bool      AddEvent(RunTimeEvent * _event);
00080 protected:
00081           CL_TEMPLATE_OBJECT_MANAGER<RunTimeEvent, int>     m_logMngr;          
00082           static LogMngr * m_mainLogMngr;
00083           LogMngr();
00084           ~LogMngr();
00085 };
00086 
00087 
00088 };//namespace SGE
00089 
00090 
00091 #endif

Generated on Mon Mar 19 23:15:11 2007 for SugoiTools by  doxygen 1.4.6-NO