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

Log.h

Go to the documentation of this file.
00001 
00009 #ifndef _LOG_H_
00010 #define _LOG_H_
00011 
00012 #include <stdio.h>
00013 #include <stdarg.h>
00014 #include <string.h>
00015 
00016 #define LOG_MAX_LEN     512
00017 
00018 #define LOG_MSG_ERROR   0
00019 #define LOG_MSG_SUCCESS 1
00020 #define LOG_MSG_MISC    2
00021 
00022 #define LOG_FILE(f)             Log::instance()->setFile(f)
00023 #define LOG_ERROR(m)    Log::instance()->printError m
00024 #define LOG_SUCCESS(m)  Log::instance()->printSuccess m
00025 #define LOG_MISC(m)             Log::instance()->printMisc m
00026 #define LOG_NEWLINE             Log::instance()->printNewline()
00027 #define LOG_CLOSE               Log::instance()->clear()
00028 
00029 class Log {
00030         public:
00031                 static Log* instance();
00032                 void clear();
00033                 void setFile(char *p_filename);
00034                 void printError(char *p_text,...);
00035                 void printSuccess(char *p_text,...);
00036                 void printMisc(char *p_text,...);
00037                 void printNewline();
00038 
00039         private:
00040                 Log();
00041                 ~Log();
00042 
00043                 void printFile(int flag, char *p_msg);
00044 
00045         private:
00046                 FILE *mp_file;
00047                 char *mp_filename;
00048                 static Log *mp_instance;
00049 };
00050 
00051 #endif

Generated on Sun Jun 5 15:47:04 2005 for Defacto by  doxygen 1.4.3