From: tho Date: Fri, 29 Feb 2008 13:07:16 +0000 (+0000) Subject: IOStreamTarget: added loglevel to output X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=067a3eb8b81aeac439116d1c556e16bdc05f54eb;p=senf.git IOStreamTarget: added loglevel to output git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@717 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/Protocols/INet/INetAddressing.test.cc b/Socket/Protocols/INet/INetAddressing.test.cc index be3dfc8..0c7a7b0 100644 --- a/Socket/Protocols/INet/INetAddressing.test.cc +++ b/Socket/Protocols/INet/INetAddressing.test.cc @@ -88,6 +88,7 @@ BOOST_AUTO_UNIT_TEST(inet6SocketAddress) { INet6SocketAddress addr; + BOOST_CHECK( ! addr ); BOOST_CHECK_EQUAL( boost::lexical_cast(addr.address()), "::" ); BOOST_CHECK_EQUAL( addr.port(), 0u ); BOOST_CHECK_EQUAL( addr.iface(), "" ); diff --git a/Utils/Logger/IOStreamTarget.cc b/Utils/Logger/IOStreamTarget.cc index 0de7da3..6d720b5 100644 --- a/Utils/Logger/IOStreamTarget.cc +++ b/Utils/Logger/IOStreamTarget.cc @@ -38,6 +38,9 @@ /////////////////////////////////////////////////////////////////////////// // senf::log::IOStreamTarget +const char * const senf::log::IOStreamTarget::LEVELNAMES_[8] = { + "NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" }; + prefix_ senf::log::IOStreamTarget::IOStreamTarget(std::ostream & os) : stream_(os) { @@ -69,7 +72,8 @@ prefix_ void senf::log::IOStreamTarget::v_write(boost::posix_time::ptime timesta for (; i != i_end; ++i) { stream_ << timestamp << sep; if (area != "senf::log::DefaultArea") - stream_ << "[" << area << "] "; + stream_ << "[" << area << "]"; + stream_ << "[" << LEVELNAMES_[level] << "] "; stream_ << *i << "\n"; sep = '-'; } diff --git a/Utils/Logger/IOStreamTarget.hh b/Utils/Logger/IOStreamTarget.hh index 84e66fc..1d976cf 100644 --- a/Utils/Logger/IOStreamTarget.hh +++ b/Utils/Logger/IOStreamTarget.hh @@ -82,9 +82,9 @@ namespace log { std::string const & message); std::ostream & stream_; + static char const * const LEVELNAMES_[8]; }; - }} ///////////////////////////////hh.e//////////////////////////////////////// diff --git a/Utils/Logger/Levels.hh b/Utils/Logger/Levels.hh index 89845da..f537fce 100644 --- a/Utils/Logger/Levels.hh +++ b/Utils/Logger/Levels.hh @@ -41,7 +41,7 @@ namespace log {
VERBOSE
Really verbose %log messages. Messages at this level are used for internal debugging. They should be enabled only selectively within the areas currently under - inspection. The default log stream senf::log::Debug has these messages disabled at + inspection. The default %log stream senf::log::Debug has these messages disabled at compile time by default. To enable them, see \ref config.
NOTICE
Arbitrary unimportant notice. Message which normally should be disabled diff --git a/Utils/Logger/Target.test.cc b/Utils/Logger/Target.test.cc index c896c26..cdcaed1 100644 --- a/Utils/Logger/Target.test.cc +++ b/Utils/Logger/Target.test.cc @@ -43,8 +43,8 @@ namespace { typedef std::string result_type; std::string operator()(senf::log::Target::RoutingEntry const & entry) const { - static char const * levels[] = { "NONE", "VERBOSE", "NOTICE", "MESSAGE", - "IMPORTANT", "CRITICAL","DISABLED" }; + static char const * levels[] = { + "NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" }; static char const * actions[] = { "ACCEPT", "REJECT" }; std::stringstream s; s << entry.stream() << "-" << entry.area() << "-" << levels[entry.level()] << "-"