diff options
author | louiz’ <louiz@louiz.org> | 2016-06-13 19:59:17 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-06-13 20:46:30 +0200 |
commit | 5a2e61161792cf51209f240e40e28036195f35be (patch) | |
tree | ed63eff92b075117e8f16e8644d715c4ca0fd132 /louloulibs/xmpp | |
parent | ad4ccdbbea129cfbab89773bea040d4149afcb2d (diff) | |
download | biboumi-5a2e61161792cf51209f240e40e28036195f35be.tar.gz biboumi-5a2e61161792cf51209f240e40e28036195f35be.tar.bz2 biboumi-5a2e61161792cf51209f240e40e28036195f35be.tar.xz biboumi-5a2e61161792cf51209f240e40e28036195f35be.zip |
Show off, with some variadic templates, for the logger module
Diffstat (limited to 'louloulibs/xmpp')
-rw-r--r-- | louloulibs/xmpp/adhoc_commands_handler.cpp | 2 | ||||
-rw-r--r-- | louloulibs/xmpp/xmpp_component.cpp | 20 | ||||
-rw-r--r-- | louloulibs/xmpp/xmpp_parser.cpp | 6 |
3 files changed, 14 insertions, 14 deletions
diff --git a/louloulibs/xmpp/adhoc_commands_handler.cpp b/louloulibs/xmpp/adhoc_commands_handler.cpp index 714c440..17c4e67 100644 --- a/louloulibs/xmpp/adhoc_commands_handler.cpp +++ b/louloulibs/xmpp/adhoc_commands_handler.cpp @@ -119,5 +119,5 @@ void AdhocCommandsHandler::remove_session(const std::string& session_id, const s this->sessions.erase(session_it); return ; } - log_error("Tried to remove ad-hoc session for [" << session_id << ", " << initiator_jid << "] but none found"); + log_error("Tried to remove ad-hoc session for [", session_id, ", ", initiator_jid, "] but none found"); } diff --git a/louloulibs/xmpp/xmpp_component.cpp b/louloulibs/xmpp/xmpp_component.cpp index b92d9a3..1be7a06 100644 --- a/louloulibs/xmpp/xmpp_component.cpp +++ b/louloulibs/xmpp/xmpp_component.cpp @@ -72,14 +72,14 @@ bool XmppComponent::is_document_open() const void XmppComponent::send_stanza(const Stanza& stanza) { std::string str = stanza.to_string(); - log_debug("XMPP SENDING: " << str); + log_debug("XMPP SENDING: ", str); this->send_data(std::move(str)); } void XmppComponent::on_connection_failed(const std::string& reason) { this->first_connection_try = false; - log_error("Failed to connect to the XMPP server: " << reason); + log_error("Failed to connect to the XMPP server: ", reason); #ifdef SYSTEMD_FOUND sd_notifyf(0, "STATUS=Failed to connect to the XMPP server: %s", reason.data()); #endif @@ -91,7 +91,7 @@ void XmppComponent::on_connected() this->first_connection_try = true; auto data = "<stream:stream to='"s + this->served_hostname + \ "' xmlns:stream='http://etherx.jabber.org/streams' xmlns='" COMPONENT_NS "'>"; - log_debug("XMPP SENDING: " << data); + log_debug("XMPP SENDING: ", data); this->send_data(std::move(data)); this->doc_open = true; // We may have some pending data to send: this happens when we try to send @@ -104,7 +104,7 @@ void XmppComponent::on_connection_close(const std::string& error) if (error.empty()) log_info("XMPP server closed connection"); else - log_info("XMPP server closed connection: " << error); + log_info("XMPP server closed connection: ", error); } void XmppComponent::parse_in_buffer(const size_t size) @@ -125,7 +125,7 @@ void XmppComponent::parse_in_buffer(const size_t size) void XmppComponent::on_remote_stream_open(const XmlNode& node) { - log_debug("XMPP RECEIVING: " << node.to_string()); + log_debug("XMPP RECEIVING: ", node.to_string()); this->stream_id = node.get_tag("id"); if (this->stream_id.empty()) { @@ -147,13 +147,13 @@ void XmppComponent::on_remote_stream_open(const XmlNode& node) digest[HASH_LENGTH * 2] = '\0'; auto data = "<handshake xmlns='" COMPONENT_NS "'>"s + digest + "</handshake>"; - log_debug("XMPP SENDING: " << data); + log_debug("XMPP SENDING: ", data); this->send_data(std::move(data)); } void XmppComponent::on_remote_stream_close(const XmlNode& node) { - log_debug("XMPP RECEIVING: " << node.to_string()); + log_debug("XMPP RECEIVING: ", node.to_string()); this->doc_open = false; } @@ -164,7 +164,7 @@ void XmppComponent::reset() void XmppComponent::on_stanza(const Stanza& stanza) { - log_debug("XMPP RECEIVING: " << stanza.to_string()); + log_debug("XMPP RECEIVING: ", stanza.to_string()); std::function<void(const Stanza&)> handler; try { @@ -172,7 +172,7 @@ void XmppComponent::on_stanza(const Stanza& stanza) } catch (const std::out_of_range& exception) { - log_warning("No handler for stanza of type " << stanza.get_name()); + log_warning("No handler for stanza of type ", stanza.get_name()); return; } handler(stanza); @@ -257,7 +257,7 @@ void XmppComponent::handle_error(const Stanza& stanza) std::string error_message("Unspecified error"); if (text) error_message = text->get_inner(); - log_error("Stream error received from the XMPP server: " << error_message); + log_error("Stream error received from the XMPP server: ", error_message); #ifdef SYSTEMD_FOUND if (!this->ever_auth) sd_notifyf(0, "STATUS=Failed to authenticate to the XMPP server: %s", error_message.data()); diff --git a/louloulibs/xmpp/xmpp_parser.cpp b/louloulibs/xmpp/xmpp_parser.cpp index dc12000..0488be9 100644 --- a/louloulibs/xmpp/xmpp_parser.cpp +++ b/louloulibs/xmpp/xmpp_parser.cpp @@ -56,7 +56,7 @@ int XmppParser::feed(const char* data, const int len, const bool is_final) int res = XML_Parse(this->parser, data, len, is_final); if (res == XML_STATUS_ERROR && (XML_GetErrorCode(this->parser) != XML_ERROR_FINISHED)) - log_error("Xml_Parse encountered an error: " << + log_error("Xml_Parse encountered an error: ", XML_ErrorString(XML_GetErrorCode(this->parser))); return res; } @@ -65,7 +65,7 @@ int XmppParser::parse(const int len, const bool is_final) { int res = XML_ParseBuffer(this->parser, len, is_final); if (res == XML_STATUS_ERROR) - log_error("Xml_Parsebuffer encountered an error: " << + log_error("Xml_Parsebuffer encountered an error: ", XML_ErrorString(XML_GetErrorCode(this->parser))); return res; } @@ -139,7 +139,7 @@ void XmppParser::stanza_event(const Stanza& stanza) const try { callback(stanza); } catch (const std::exception& e) { - log_error("Unhandled exception: " << e.what()); + log_error("Unhandled exception: ", e.what()); } } } |