From d890efe9b44bcdaec516c710079e84bea8bf8a34 Mon Sep 17 00:00:00 2001 From: g0dil <g0dil@wiback.org> Date: Mon, 10 Nov 2008 15:08:08 +0000 Subject: [PATCH] Utils/Logger: Target examples\nPackets: Relax annotation type restrictions --- Packets/PacketImpl.hh | 7 +++++-- Utils/Logger/FileTarget.hh | 7 +++++++ Utils/Logger/SyslogTarget.hh | 7 +++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Packets/PacketImpl.hh b/Packets/PacketImpl.hh index ea76bd60a..667eebb15 100644 --- a/Packets/PacketImpl.hh +++ b/Packets/PacketImpl.hh @@ -31,7 +31,8 @@ #include <vector> #include <boost/utility.hpp> #include <boost/type_traits/is_base_of.hpp> -#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/has_trivial_constructor.hpp> +#include <boost/type_traits/has_trivial_destructor.hpp> #include <boost/static_assert.hpp> #include "../Utils/pool_alloc_mixin.hh" #include "PacketTypes.hh" @@ -98,7 +99,9 @@ namespace detail { # ifdef BOOST_HAS_TYPE_TRAITS_INTRINSICS - BOOST_STATIC_ASSERT(( boost::is_pod<Annotation>::value || Complex )); + BOOST_STATIC_ASSERT(( (boost::has_trivial_constructor<Annotation>::value + && boost::has_trivial_destructor<Annotation>::value) + || Complex )); # endif }; diff --git a/Utils/Logger/FileTarget.hh b/Utils/Logger/FileTarget.hh index cd5c71a12..45f11fd1e 100644 --- a/Utils/Logger/FileTarget.hh +++ b/Utils/Logger/FileTarget.hh @@ -42,6 +42,13 @@ namespace log { The FileTarget will save all %log messages in the given file. Messages will be appended at the end of the file. + \code + senf::log::FileTarget target ("file.name"); + + // Route all messages to this file. + target.route(); + \endcode + After %log files have been rotated, the reopen() member should be called to create a new %log file. diff --git a/Utils/Logger/SyslogTarget.hh b/Utils/Logger/SyslogTarget.hh index 3de11ec78..18a155948 100644 --- a/Utils/Logger/SyslogTarget.hh +++ b/Utils/Logger/SyslogTarget.hh @@ -40,6 +40,13 @@ namespace log { The SyslogTarget will send all log messages to the syslog at the given facility. + \code + senf::log::SyslogTarget syslog; + + // Route all messages to the syslog + syslog.route(); + \endcode + Valid facility values (taken from <tt>man 3 syslog</tt>): \par "" <tt>LOG_AUTHPRIV</tt>, <tt>LOG_CRON</tt>, <tt>LOG_DAEMON</tt>, <tt>LOG_FTP</tt>, -- GitLab