00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __libutilxx__sella__util__LogFormat_H__
00010 #define __libutilxx__sella__util__LogFormat_H__
00011
00012 #include "../../common.h"
00013 #include "../Exception.h"
00014
00015 #include <syslog.h>
00016 #include <sys/time.h>
00017
00018 #include <string>
00019
00020 namespace sella {
00021 namespace util {
00022 class LogFormat;
00023 class Log;
00024 }
00025 }
00026
00027 class sella::util::LogFormat {
00028 friend class Log;
00029
00030 public:
00031 static const std::string DefaultStampFormat;
00032
00033 LogFormat(const std::string &stamp = DefaultStampFormat, bool micro = true) throw ();
00034
00035 virtual sella::util::LogFormat* clone(void) const throw () = 0;
00036
00037 protected:
00038 virtual const std::string format(int priority, const char *stamp, const char *func, const char *file, int line, const sella::Exception &e, const char *message) throw () = 0;
00039 virtual const std::string format(int priority, const char *stamp, const char *func, const char *file, int line, const char *message) throw () = 0;
00040 virtual const std::string format(int priority, const char *stamp, const char *func, const char *file, int line, const char *option, const char *message) throw () = 0;
00041
00042 std::string format(const struct timeval &stamp) throw ();
00043
00044 protected:
00045 std::string stamp;
00046 bool micro;
00047 };
00048
00049 #endif
00050
00051
00052
00053