ensured LogPrefix is used in DNS and PingScheduler; shortened lines; remove vim end...
[pingcheck] / src / dns / dnsmaster.cpp
index 9592e1c..f25f09c 100644 (file)
@@ -42,7 +42,7 @@ void DnsMaster::create_master(const IoServiceItem &io_serv,
                             const int max_address_resolution_attempts,
                             const std::string &cache_file)
 {
-    GlobalLogger.info() << "Creating DNS Cache";
+    GlobalLogger.info() << "DnsMaster: Creating cache";
     DnsCacheItem cache( new DnsCache(io_serv, cache_file) );
     create_master(io_serv, default_name_server, resolved_ip_ttl_threshold,
                   max_address_resolution_attempts, cache);
@@ -56,12 +56,12 @@ void DnsMaster::create_master(const IoServiceItem &io_serv,
 {
     if (TheOnlyInstance)
     {
-        GlobalLogger.warning()
-            << "Blocking attempt to create another DnsMaster instance!";
+        GlobalLogger.warning() << "DnsMaster: "
+                              << "Blocking attempt to create another instance!";
         return;
     }
 
-    GlobalLogger.info() << "Creating DNS Master";
+    GlobalLogger.info() << "DNS Master: creating instance";
     TheOnlyInstance.reset( new DnsMaster(io_serv,
                                          default_name_server,
                                          resolved_ip_ttl_threshold,
@@ -88,19 +88,19 @@ DnsMaster::DnsMaster(const IoServiceItem &io_serv,
 DnsMasterItem& DnsMaster::get_instance()
 {
     if ( !TheOnlyInstance )
-        GlobalLogger.error()
-            << "Request to return DnsMaster instance before creating it!";
+        GlobalLogger.error() << "DnsMaster: "
+                            << "Request to return instance before creating it!";
     return TheOnlyInstance;
 }
 
 DnsMaster::~DnsMaster()
 {
-    GlobalLogger.info() << "DnsMaster is being destructed";
+    GlobalLogger.info() << "DnsMaster: being destructed";
 
     if (DnsMaster::TheOnlyInstance)
     {   // apparently, this static variable still exists while itself is
         // destructed...
-        //GlobalLogger.warning() << "DnsMaster is being destructed that is not "
+        //GlobalLogger.warning() << "DnsMaster: being destructed but not "
         //                       << "singleton instance TheOnlyInstance!";
         DnsMaster::TheOnlyInstance.reset();
     }
@@ -135,10 +135,12 @@ ResolverItem& DnsMaster::get_resolver_for(const std::string &hostname,
                               = boost::asio::ip::address::from_string(hostname);
             if ( (protocol == DNS_IPv4 && !ip.is_v4()) ||
                  (protocol == DNS_IPv6 && !ip.is_v6()) )
-                GlobalLogger.warning() << "Asked to create a DNS resolver "
+                GlobalLogger.warning() << "DnsMaster:"
+                                       << "Asked to create a DNS resolver "
                                        << "for wrong IP protocol: v4 != v6! "
                                        << "We will comply.";
-            GlobalLogger.info() << "Creating PseudoResolver for IP " << ip;
+            GlobalLogger.info() << "DnsMaster: Creating PseudoResolver for IP "
+                                << ip;
             ResolverItem new_resolver( new IpPseudoResolver(IoService,
                                                             hostname,
                                                             Cache) );
@@ -188,7 +190,7 @@ DnsIpProtocol DnsMaster::ping2dns_protocol(const PingProtocol& pprot)
         case PingProtocol_TCP:      return DNS_IPv4; break;
         case PingProtocol_TCP_IPv6: return DNS_IPv6; break;
         default:
-            GlobalLogger.warning() << "Unexpected ping protocol: "
+            GlobalLogger.warning() << "DnsMaster: Unexpected ping protocol: "
                                    << static_cast<int>(pprot);
             return DNS_IPALL;
             break;
@@ -221,5 +223,3 @@ std::string to_string(const DnsIpProtocol &protocol)
                  return "Unexpected Protocol"; break;
     }
 }
-// (created using vim -- the world's best text editor)
-