changes in logging output: added information and changed priority
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 5 Nov 2014 14:08:58 +0000 (15:08 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 5 Nov 2014 14:08:58 +0000 (15:08 +0100)
src/dns/dnsresolver.cpp
src/icmp/icmpv4header.cpp
src/ip/ipv4header.cpp
src/main.cpp

index 4ac11cb..6e44343 100644 (file)
@@ -93,7 +93,7 @@ bool DnsResolver::resolve()
         return true;
     }
 
-    GlobalLogger.info() << "Resolved IP(s) for host : " << HostDnsAddress << endl;
+    GlobalLogger.info() << "Trying to resolve IP(s) for host : " << HostDnsAddress << endl;
 
     try
     {
@@ -216,7 +216,7 @@ bool DnsResolver::handle_ip_address()
     }
     catch ( const boost::system::system_error & /*ex*/ )
     {
-        GlobalLogger.info() << "Host is not an IP: " << HostDnsAddress << endl;
+        GlobalLogger.debug() << "Host is not an IP: " << HostDnsAddress << endl;
     }
 
     return false;
index fbf441c..fcfcd51 100644 (file)
@@ -11,6 +11,9 @@
 #include "icmp/icmpechorequestmessage.h"
 #include "icmp/icmpgenericmessage.h"
 
+#include <logfunc.hpp>
+using I2n::Logger::GlobalLogger;
+
 using namespace std;
 using boost::shared_ptr;
 
@@ -132,6 +135,7 @@ void Icmpv4Header::set_icmp_message_format( const Icmpv4Type type )
                 break;
             case Icmpv4Type_InvalidLast:
             default:
+                GlobalLogger.error() << "Invalid ICMPv4 message type " << static_cast<int>(type) << "!";
                 BOOST_ASSERT( !"Try to set an invalid ICMPv4 message type" );
                 break;
         }
index 1c0dc22..42ba81e 100644 (file)
@@ -217,10 +217,12 @@ istream &operator>>(
     // and stores in the buffer object
     (void) header.Payload.read( is );
 
-    if ( header.get_version() != 4 )
+    uint8_t header_version = header.get_version();
+    if ( header_version != 4 )
     {
-        GlobalLogger.error() << "Error: invalid IP header version." << endl;
+        GlobalLogger.error() << "Error: invalid IP header version: " << static_cast<int>(header_version) << endl;
         is.setstate( ios::failbit );
+        return is;
     }
 
     // read the consecutive N bytes (for options field) from the input stream
@@ -229,7 +231,7 @@ istream &operator>>(
                                 static_cast<streamsize>( Ipv4HeaderSizeInBytes );
     if ( ( options_length < 0 ) || ( 40 < options_length ) )
     {
-        GlobalLogger.error() << "Error: invalid IP options length value." << endl;
+        GlobalLogger.error() << "Error: invalid IP options length value:" << options_length << endl;
         is.setstate( ios::failbit );
     }
     else if ( ( 0 < options_length ) && ( options_length <= 40 ) )
index 916e5f1..44e96c0 100644 (file)
@@ -341,6 +341,7 @@ int main( int argc, const char *argv[] )
     {
         int log_level = configuration->get_log_level();
         I2n::Logger::set_log_level( log_level );                                                    //lint !e534
+        GlobalLogger.info() << "Set LogLevel to " << I2n::Logger::level_string() << endl;
 
         set_log_output( configuration );