Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/log.h

00001 /***************************************************************************
00002  *            log.h
00003  *
00004  *  Sun Sep 12 18:06:59 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024  
00025 #ifndef _LOG_H
00026 #define _LOG_H
00027 
00028 #ifdef WIN32
00029 #include <windows.h>
00030 #endif
00031 
00032 
00033 #include <string>
00034 #include <iostream>
00035 using namespace std;
00036 #include "build.h"
00037 
00038 
00039 #define MSG_INFO_STR "<Info> "
00040 #define MSG_WARNING_STR "<Warning> "
00041 #define MSG_ERROR_STR "<Error> "
00042 #define MSG_DEBUG_STR "<Debug> "
00043 
00044 namespace ngn
00045 {
00046 
00047         typedef enum NGN_LOG_MODE
00048         {
00049                 LOG_NO_LOG,
00050                 LOG_FILE,
00051                 LOG_CONSOLE,
00052                 LOG_NGN_CONSOLE,
00053                 LOG_SCREEN
00054         };
00055         typedef enum NGN_MSG_TYPE
00056         {
00057                 MSG_INFO,
00058                 MSG_WARNING,
00059                 MSG_ERROR,
00060                 MSG_DEBUG
00061         };
00062 
00063 
00064 
00065         namespace sys
00066         {
00067                 
00075         class NGN_API Log 
00076                 {
00077                         public:
00078                                 
00079                                 Log();
00080                                 virtual ~Log();
00081                         
00083                                 void setLogMode( NGN_LOG_MODE mode );
00085                                 NGN_LOG_MODE getLogMode() const;
00087                                 void setLogFileName( std::string filename );
00089                                 void log( std::string msg, NGN_MSG_TYPE msg_type = MSG_INFO );
00090 
00091                                                         
00092                         private:
00093                                 
00094                                 void logToConsole( std::string msg, NGN_MSG_TYPE msg_type );
00095                                 void logToFile( std::string msg, NGN_MSG_TYPE msg_type );
00096                                 void logToNGNConsole( std::string msg, NGN_MSG_TYPE msg_type );
00097                                 void logToScreen( std::string msg, NGN_MSG_TYPE msg_type );
00098                         
00099                         
00100                                 NGN_LOG_MODE m_mode;
00101                                 std::string m_logfile;
00102                                 std::string m_msg_type;
00103                                                         
00104                 };
00105 
00106         
00107                 
00108         }//sys
00109 }//ngn
00110 #endif /* _LOG_H */

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1