IOStreamTarget: added loglevel to output
tho [Fri, 29 Feb 2008 13:07:16 +0000 (13:07 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@717 270642c3-0616-0410-b53a-bc976706d245

Socket/Protocols/INet/INetAddressing.test.cc
Utils/Logger/IOStreamTarget.cc
Utils/Logger/IOStreamTarget.hh
Utils/Logger/Levels.hh
Utils/Logger/Target.test.cc

index be3dfc8..0c7a7b0 100644 (file)
@@ -88,6 +88,7 @@ BOOST_AUTO_UNIT_TEST(inet6SocketAddress)
 
     {
         INet6SocketAddress addr;
+        BOOST_CHECK( ! addr );
         BOOST_CHECK_EQUAL( boost::lexical_cast<std::string>(addr.address()), "::" );
         BOOST_CHECK_EQUAL( addr.port(), 0u );
         BOOST_CHECK_EQUAL( addr.iface(), "" );
index 0de7da3..6d720b5 100644 (file)
@@ -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 = '-';
     }
index 84e66fc..1d976cf 100644 (file)
@@ -82,9 +82,9 @@ namespace log {
                      std::string const & message);
 
         std::ostream & stream_;
+        static char const * const LEVELNAMES_[8];
     };
 
-
 }}
 
 ///////////////////////////////hh.e////////////////////////////////////////
index 89845da..f537fce 100644 (file)
@@ -41,7 +41,7 @@ namespace log {
 
         <dl><dt>VERBOSE</dt><dd>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 <em>disabled</em> at
+        inspection. The default %log stream senf::log::Debug has these messages <em>disabled</em> at
         compile time by default. To enable them, see \ref config.</dd>
 
         <dt>NOTICE</dt><dd>Arbitrary unimportant notice. Message which normally should be disabled
index c896c26..cdcaed1 100644 (file)
@@ -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()] << "-"