00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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 }
00109 }
00110 #endif