Added Log messages.
*/
void Logger::print_error_hostname_to_ip(const string& exception, const string& hostname) const
{
- int level = 1;
+ int level = 0;
if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
{
ostringstream msg;
/**
- * Not authorized to perform requested http operation
- * @param url The requested url
+ * Not authorized to perform requested update operation
+ * @param service The requested service.
* @param username Username
* @param password Password
*/
-void Logger::print_http_not_authorized(const string& url, const string& username, const string& password) const
+void Logger::print_service_not_authorized(const string& service, const string& username, const string& password) const
{
int level = 0;
if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
{
ostringstream msg;
- msg << "Not authorized to perform update operation on url: " << url << " Please check username and password: " << username << ":" << password << endl;
+ msg << "Not authorized to perform update operation on service: " << service << " Please check username and password: " << username << ":" << password << endl;
log_warning(msg.str(),level);
}
}
log_error(msg.str(),level);
}
}
+
+
+/**
+ * An network exception occured.
+ * @param what The exception occured.
+ */
+void Logger::print_network_error(const std::string& what) const
+{
+ int level = 0;
+ if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+ {
+ ostringstream msg;
+ msg << "An netowrk exception occured: " << what << endl;
+ log_error(msg.str(),level);
+ }
+}
+
+
+/**
+ * An undefined protocol error occured.
+ * @param protocol The protocol
+ * @param error The error
+ */
+void Logger::print_undefined_protocol_error(const std::string& protocol, const std::string& error) const
+{
+ int level = 0;
+ if ( (level <= Loglevel) || ((level <= ExternalWarningLevel) && (!ExternalWarningLog.empty())) )
+ {
+ ostringstream msg;
+ msg << "An undefined protocol error occured. Protocol: " << protocol << " Error: " << error << endl;
+ log_error(msg.str(),level);
+ }
+}
void print_curl_data(const std::string& curl_writedata_buff) const;
- void print_http_not_authorized(const std::string& url, const std::string& username, const std::string& password) const;
+ void print_service_not_authorized(const std::string& service, const std::string& username, const std::string& password) const;
void print_http_status_code(const std::string& url, const long http_code) const;
void print_gnudip_requires_servername() const;
void print_exception_md5_sum(const std::string& what) const;
+
+ void print_network_error(const std::string& what) const;
+
+ void print_undefined_protocol_error(const std::string& protocol, const std::string& error) const;
};
#endif
}
else if ( http_status_code == 401 )
{
- get_logger()->print_http_not_authorized(url,get_login(),get_password());
+ get_logger()->print_service_not_authorized(url,get_login(),get_password());
}
else
{
}
else if ( curl_data == "badauth" )
{
- get_logger()->print_http_not_authorized(url,get_login(),get_password());
+ get_logger()->print_service_not_authorized(url,get_login(),get_password());
}
else
{
}
else if ( status_code == "401" )
{
- get_logger()->print_http_not_authorized(url,get_login(),get_password());
+ get_logger()->print_service_not_authorized(url,get_login(),get_password());
}
else
{
}
else if ( curl_data == "NOACCESS" )
{
- get_logger()->print_http_not_authorized(url,get_login(),get_password());
+ get_logger()->print_service_not_authorized(url,get_login(),get_password());
}
else
{
// create http helper class
HTTPHelper::Ptr _http_help(new HTTPHelper(_logger,_proxy,_proxy_port,_login,_password));
- HTTPHelp = _http_help;
- _http_help.reset();
+ HTTPHelp.swap(_http_help);
BaseUrl = assemble_base_url(get_hostname(),_gnudip_server);
}
}
else if ( update_return_code == "1" )
{
- get_logger()->print_http_not_authorized(url,get_login(),get_password());
+ get_logger()->print_service_not_authorized(url,get_login(),get_password());
}
else
{
}
else if ( status_code == "401" )
{
- get_logger()->print_http_not_authorized(url,get_login(),get_password());
+ get_logger()->print_service_not_authorized(url,get_login(),get_password());
}
else
{
}
else if ( http_status_code == 401 )
{
- get_logger()->print_http_not_authorized(url,get_login(),get_password());
+ get_logger()->print_service_not_authorized(url,get_login(),get_password());
}
else
{