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
00026 #ifndef ARLOG_H
00027 #define ARLOG_H
00028
00029 #ifndef WIN32
00030 #include <stdio.h>
00031 #endif
00032 #include <string>
00033 #include "ariaTypedefs.h"
00034 #include "ArMutex.h"
00035 #include "ArFunctor.h"
00036
00037 class ArConfig;
00038
00040
00047 class ArLog
00048 {
00049 public:
00050
00051 typedef enum {
00052 StdOut,
00053 StdErr,
00054 File,
00055 Colbert,
00056 None
00057 } LogType;
00058 typedef enum {
00059 Terse,
00060 Normal,
00061 Verbose
00062 } LogLevel;
00063
00064 #ifndef SWIG
00065
00071 AREXPORT static void log(LogLevel level, const char *str, ...);
00072 #endif
00073
00074 AREXPORT static void logPlain(LogLevel level, const char *str);
00076 AREXPORT static bool init(LogType type, LogLevel level,
00077 const char *fileName="",
00078 bool logTime = false, bool alsoPrint = false,
00079 bool printThisCall = true);
00081 AREXPORT static void close();
00082
00083 #ifndef SWIG // this is internal we don't need to wrap it
00084
00087 AREXPORT static void logNoLock(LogLevel level, const char *str, ...);
00088 #endif
00089
00090 AREXPORT static void (* colbertPrint)(int i, const char *str);
00091
00093 AREXPORT static void addToConfig(ArConfig *config);
00094 protected:
00095 AREXPORT static bool processFile(void);
00096
00097 static ArLog *ourLog;
00098 static ArMutex ourMutex;
00099 static LogType ourType;
00100 static LogLevel ourLevel;
00101 static bool ourLoggingTime;
00102 static FILE *ourFP;
00103 static int ourColbertStream;
00104 static std::string ourFileName;
00105 static bool ourAlsoPrint;
00106
00107 static LogType ourConfigLogType;
00108 static LogLevel ourConfigLogLevel;
00109 static char ourConfigFileName[1024];
00110 static bool ourConfigLogTime;
00111 static bool ourConfigAlsoPrint;
00112 static ArGlobalRetFunctor<bool> ourConfigProcessFileCB;
00113 };
00114
00115
00116 #endif