/usr/include/bobcat/syslogstream is in libbobcat-dev 4.01.03-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | #ifndef INCLUDED_BOBCAT_SYSLOGSTREAM_
#define INCLUDED_BOBCAT_SYSLOGSTREAM_
// options (default: none):
//
// LOG_CONS
// write directly to system console if there is an
// error while sending to system logger
//
// LOG_NDELAY
// open the connection immediately (normally, the con-
// nection is opened when the first message is logged)
//
// LOG_PERROR
// print to stderr as well
//
// LOG_PID
// include PID with each message
//
//
// facility
// type of program doing the logging. LOG_USER is used as default:
//
// LOG_AUTHPRIV
// security/authorization messages (private)
//
// LOG_CRON
// clock daemon (cron and at)
//
// LOG_DAEMON
// other system daemons
//
// LOG_KERN
// kernel messages
//
// LOG_LOCAL0 through LOG_LOCAL7
// reserved for local use
//
// LOG_LPR
// line printer subsystem
//
// LOG_MAIL
// mail subsystem
//
// LOG_NEWS
// USENET news subsystem
//
// LOG_SYSLOG
// messages generated internally by syslogd
//
// LOG_USER(default)
// generic user-level messages
//
// LOG_UUCP
// UUCP subsystem
//
// level (priority):
//
// LOG_NOTICE is used by default.
// This determines the importance of the message. The levels
// are, in order of decreasing importance:
//
// LOG_EMERG
// system is unusable
//
// LOG_ALERT
// action must be taken immediately
//
// LOG_CRIT
// critical conditions
//
// LOG_ERR
// error conditions
//
// LOG_WARNING
// warning conditions
//
// LOG_NOTICE (Used as DEFAULT)
// normal, but significant, condition
//
// LOG_INFO
// informational message
//
// LOG_DEBUG
// debug-level message
#include <bobcat/syslogbuf>
#include <ostream>
#include <syslog.h>
namespace FBB
{
class SyslogStream: private Syslogbuf, public std::ostream
{
public:
explicit SyslogStream(std::string const &ident = "",
Priority priority = NOTICE, Facility facility = USER,
int option = 0);
explicit SyslogStream(char const *ident,
Priority priority = NOTICE, Facility facility = USER,
int option = 0);
Priority priority() const; // .f
Priority defaultPriority() const; // .f
Priority setPriority(Priority priority); // .f
Priority setDefaultPriority(Priority priority); // .f
void open(std::string const &ident, // .f
Priority priority = NOTICE, Facility facility = USER,
int option = 0);
void close(); // .f
static Priority stoP(std::string const &name,
Priority priority = NOTICE);
static Facility stoF(std::string const &name,
Facility facility = USER);
static int setMask(Priority p1, PriorityType upTo); // 1.f
static int setMask(Priority p1); // 2.f
template <typename ...Priorities>
static int setMask(Priority p1, Priorities ...ps); // 3.f
// MANIPULATORS:
static std::ostream &emerg(std::ostream &str); // .f
static std::ostream &alert(std::ostream &str); // .f
static std::ostream &crit(std::ostream &str); // .f
static std::ostream &err(std::ostream &str); // .f
static std::ostream &warning(std::ostream &str); // .f
static std::ostream ¬ice(std::ostream &str); // .f
static std::ostream &info(std::ostream &str); // .f
static std::ostream &debug(std::ostream &str); // .f
static std::ostream &strerrno(std::ostream &str); // .f
private:
static std::ostream &setPriority(std::ostream &str,
Priority priority);
static int maskValue(Priority p1); // 1.f
template <typename ...Priorities>
static int maskValue(Priority p1, Priorities ...ps); // 2.f
static int setMask(int maskValue, PriorityType upTo);
};
inline std::ostream &SyslogStream::alert(std::ostream &str)
{
return setPriority(str, ALERT);
}
inline void SyslogStream::close()
{
Syslogbuf::close();
}
inline std::ostream &SyslogStream::crit(std::ostream &str)
{
return setPriority(str, CRIT);
}
inline std::ostream &SyslogStream::debug(std::ostream &str)
{
return setPriority(str, DEBUG);
}
inline Priority SyslogStream::defaultPriority() const
{
return Syslogbuf::defaultPriority();
}
inline std::ostream &SyslogStream::emerg(std::ostream &str)
{
return setPriority(str, EMERG);
}
inline std::ostream &SyslogStream::err(std::ostream &str)
{
return setPriority(str, ERR);
}
inline std::ostream &SyslogStream::info(std::ostream &str)
{
return setPriority(str, INFO);
}
inline std::ostream &SyslogStream::notice(std::ostream &str)
{
return setPriority(str, NOTICE);
}
inline void SyslogStream::open(std::string const &ident, Priority priority,
Facility facility, int option)
{
Syslogbuf::open(ident, priority, facility, option);
}
inline Priority SyslogStream::priority() const
{
return Syslogbuf::priority();
}
inline Priority SyslogStream::setDefaultPriority(Priority priority)
{
return Syslogbuf::setDefaultPriority(priority);
}
inline int SyslogStream::setMask(Priority p1, PriorityType upTo)
{
return setMask(maskValue(p1), upTo);
}
inline int SyslogStream::setMask(Priority p1)
{
return setMask(maskValue(p1), SINGLE);
}
template <typename ...Priorities>
inline int SyslogStream::setMask(Priority p1, Priorities ...ps)
{
return setMask(maskValue(p1, ps ...), SINGLE);
}
inline Priority SyslogStream::setPriority(Priority priority)
{
return Syslogbuf::setPriority(priority);
}
inline std::ostream &SyslogStream::warning(std::ostream &str)
{
return setPriority(str, WARNING);
}
// The following private inline members, must remain here as they are used by
// the setMask member template
inline int SyslogStream::maskValue(Priority p1)
{
return 1 << p1;
}
template <typename ...Priorities>
inline int SyslogStream::maskValue(Priority p1, Priorities ...ps)
{
return ((1 << p1) | maskValue(ps ...));
}
inline int SyslogStream::setMask(int maskValue, PriorityType upTo)
{
// if upTo, maskValue is 2**x, and all its lower bits are also raised
return setlogmask(upTo == SINGLE ?
maskValue : maskValue |= (maskValue - 1));
}
} // FBB
#endif
|