2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * WvSyslog is a descendant of WvLogRcv that sends messages to the syslogd
13 WvSyslog::WvSyslog(WvStringParm _prefix
, bool _include_appname
,
14 WvLog::LogLevel _first_debug
,
15 WvLog::LogLevel _max_level
)
16 : WvLogRcv(_max_level
), syslog_prefix(_prefix
)
18 first_debug
= _first_debug
;
19 include_appname
= _include_appname
;
20 openlog(syslog_prefix
, 0, LOG_DAEMON
);
31 void WvSyslog::_begin_line()
34 current
.put(prefix
, prelen
);
38 void WvSyslog::_mid_line(const char *str
, size_t len
)
40 current
.put(str
, len
);
44 void WvSyslog::_end_line()
53 static LevMap levmap
[] = {
54 {WvLog::Critical
, LOG_CRIT
},
55 {WvLog::Error
, LOG_ERR
},
56 {WvLog::Warning
, LOG_WARNING
},
57 {WvLog::Notice
, LOG_NOTICE
},
58 {WvLog::Info
, LOG_INFO
},
59 {WvLog::Debug
, LOG_DEBUG
},
68 for (count
= 0; levmap
[count
].wvlog_lvl
>= 0; count
++)
70 if (last_level
>= levmap
[count
].wvlog_lvl
)
71 lev
= levmap
[count
].syslog_lvl
;
74 if (last_level
< first_debug
&& lev
== LOG_DEBUG
)
79 current
.put("", 1); // null-terminate
80 syslog(lev
, "%s", current
.get(current
.used()));
83 current
.zap(); // not important enough to print this message