4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief SyslogTarget public header */
31 #ifndef HH_SENF_Utils_Logger_SyslogTarget_
32 #define HH_SENF_Utils_Logger_SyslogTarget_ 1
36 #include <boost/shared_ptr.hpp>
39 //#include "SyslogTarget.mpp"
40 //-/////////////////////////////////////////////////////////////////////////////////////////////////
44 namespace console { class DirectoryNode; }
48 /** \brief Log target writing to the syslog
50 The SyslogTarget will send all %log messages to the syslog at the given facility.
53 senf::log::SyslogTarget syslog;
55 // Route all messages to the syslog
59 Valid facility values (taken from <tt>man 3 syslog</tt>):
61 <tt>LOG_AUTHPRIV</tt>, <tt>LOG_CRON</tt>, <tt>LOG_DAEMON</tt>, <tt>LOG_FTP</tt>,
62 <tt>LOG_KERN</tt>, <tt>LOG_LOCAL0</tt>, <tt>LOG_LOCAL1</tt>, <tt>LOG_LOCAL2</tt>,
63 <tt>LOG_LOCAL3</tt>, <tt>LOG_LOCAL4</tt>, <tt>LOG_LOCAL5</tt>, <tt>LOG_LOCAL6</tt>,
64 <tt>LOG_LOCAL7</tt>, <tt>LOG_LPR</tt>, <tt>LOG_MAIL</tt>, <tt>LOG_NEWS</tt>,
65 <tt>LOG_SYSLOG</tt>, <tt>LOG_USER</tt>, <tt>LOG_UUCP</tt>
67 The default facility is <tt>LOG_USER</tt>.
69 The SENF log levels are mapped to syslog levels in the following way:
71 <table class="senf fixedcolumn">
72 <tr><td>senf::log::VERBOSE</td> <td>\c LOG_DEBUG</td></tr>
73 <tr><td>senf::log::NOTICE</td> <td>\c LOG_INFO</td></tr>
74 <tr><td>senf::log::MESSAGE</td> <td>\c LOG_NOTICE</td></tr>
75 <tr><td>senf::log::IMPORTANT</td> <td>\c LOG_WARNING</td></tr>
76 <tr><td>senf::log::CRITICAL</td> <td>\c LOG_CRIT</td></tr>
77 <tr><td>senf::log::FATAL</td> <td>\c LOG_EMERG</td></tr>
86 //-////////////////////////////////////////////////////////////////////////
87 ///\name Structors and default members
90 explicit SyslogTarget(int facility = LOG_USER);
93 //-////////////////////////////////////////////////////////////////////////
96 void v_write(time_type timestamp, std::string const & stream,
97 std::string const & area, unsigned level,
98 std::string const & message);
103 static int const LEVELMAP[8];
106 AUTHPRIV = LOG_AUTHPRIV,
128 struct RegisterConsole {
130 static boost::shared_ptr<console::DirectoryNode> create(
131 LogFacility facility);
132 static RegisterConsole instance;
138 //-/////////////////////////////////////////////////////////////////////////////////////////////////
139 #include "SyslogTarget.cci"
140 //#include "SyslogTarget.ct"
141 //#include "SyslogTarget.cti"
148 // comment-column: 40
149 // c-file-style: "senf"
150 // indent-tabs-mode: nil
151 // ispell-local-dictionary: "american"
152 // compile-command: "scons -u test"