00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QOLYESTER_UTL_SYSLOG_HH
00020 # define QOLYESTER_UTL_SYSLOG_HH 1
00021
00022 # include <streambuf>
00023 # include <syslog.h>
00024 # include <cassert>
00025 # include <cstring>
00026
00027 namespace olsr {
00028
00029 namespace utl {
00030
00031 # define SYSLOG_BUFFER_SIZE 4096
00032
00033 class SyslogBuf : public std::streambuf {
00034 typedef std::streambuf Super;
00035 typedef Super::char_type char_type;
00036 typedef Super::traits_type traits_type;
00037 typedef Super::int_type int_type;
00038 typedef Super::pos_type pos_type;
00039 typedef Super::off_type off_type;
00040 public:
00041 SyslogBuf(int prio);
00042 ~SyslogBuf();
00043 int_type overflow(int_type c = traits_type::eof());
00044 Super* setbuf(char_type* s, std::streamsize n);
00045 int sync();
00046 private:
00047 int prio_;
00048 bool ours_;
00049 unsigned size_;
00050 char_type* buffer_;
00051 };
00052
00053 }
00054
00055 }
00056
00057 #endif // !QOLYESTER_UTL_SYSLOG_HH