Block service for a short period of time on too many update errors
[bpdyndnsd] / src / logger.cpp
index 3b00e56..f26fb91 100644 (file)
@@ -374,7 +374,7 @@ void Logger::print_constructor_call(const string& _class) const
 
 /**
  * Update method for specified service was called.
- * @param service The service for which is the update running.
+ * @param service The service for which the update is running.
  */
 void Logger::print_update_service(const string& service) const
 {
@@ -387,6 +387,39 @@ void Logger::print_update_service(const string& service) const
     }
 }
 
+/**
+ * Service is blocked for update because of too many errors
+ * @param service The service for which the update is running.
+ * @param remaining_seconds Remaining seconds this service is blocked
+ */
+void Logger::print_update_service_is_blocked(const std::string& service, int remaining_seconds) const
+{
+    int level = 1;
+    if ( level <= Loglevel )
+    {
+        ostringstream msg;
+        msg << "Service " << service << " is blocked for " << remaining_seconds << " seconds because of too many errors" << endl;
+        log_notice(msg.str());
+    }
+}
+
+
+/**
+ * Service will be blocked because of update errors
+ * @param service The service for which the update is running.
+ * @param block_seconds Number of seconds this service is blocked
+ */
+void Logger::print_block_service(const std::string& service, int block_seconds) const
+{
+    int level = 0;
+    if ( level <= Loglevel )
+    {
+        ostringstream msg;
+        msg << "Service " << service << " will be blocked for " << block_seconds << " seconds because of too many errors" << endl;
+        log_notice(msg.str());
+    }
+}
+
 
 /**
  * An unknown option on the command line was detected.