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 __UTILS_LOGGING_FILE_H_
00026 #define __UTILS_LOGGING_FILE_H_
00027
00028 #include <utils/logging/logger.h>
00029 #include <ctime>
00030
00031 namespace fawkes {
00032
00033
00034 class Mutex;
00035 class File;
00036
00037 class FileLogger : public Logger
00038 {
00039 public:
00040 FileLogger(const char* filename, LogLevel min_level = LL_DEBUG);
00041 virtual ~FileLogger();
00042
00043 virtual void log_debug(const char *component, const char *format, ...);
00044 virtual void log_info(const char *component, const char *format, ...);
00045 virtual void log_warn(const char *component, const char *format, ...);
00046 virtual void log_error(const char *component, const char *format, ...);
00047
00048 virtual void vlog_debug(const char *component, const char *format, va_list va);
00049 virtual void vlog_info(const char *component, const char *format, va_list va);
00050 virtual void vlog_warn(const char *component, const char *format, va_list va);
00051 virtual void vlog_error(const char *component, const char *format, va_list va);
00052
00053 virtual void log_debug(const char *component, Exception &e);
00054 virtual void log_info(const char *component, Exception &e);
00055 virtual void log_warn(const char *component, Exception &e);
00056 virtual void log_error(const char *component, Exception &e);
00057
00058
00059 virtual void tlog_debug(struct timeval *t, const char *component, const char *format, ...);
00060 virtual void tlog_info(struct timeval *t, const char *component, const char *format, ...);
00061 virtual void tlog_warn(struct timeval *t, const char *component, const char *format, ...);
00062 virtual void tlog_error(struct timeval *t, const char *component, const char *format, ...);
00063
00064 virtual void tlog_debug(struct timeval *t, const char *component, Exception &e);
00065 virtual void tlog_info(struct timeval *t, const char *component, Exception &e);
00066 virtual void tlog_warn(struct timeval *t, const char *component, Exception &e);
00067 virtual void tlog_error(struct timeval *t, const char *component, Exception &e);
00068
00069 virtual void vtlog_debug(struct timeval *t, const char *component,
00070 const char *format, va_list va);
00071 virtual void vtlog_info(struct timeval *t, const char *component,
00072 const char *format, va_list va);
00073 virtual void vtlog_warn(struct timeval *t, const char *component,
00074 const char *format, va_list va);
00075 virtual void vtlog_error(struct timeval *t, const char *component,
00076 const char *format, va_list va);
00077
00078 private:
00079 struct ::tm *now_s;
00080
00081 File *log_file;
00082 Mutex *mutex;
00083 };
00084
00085
00086 }
00087
00088 #endif