From 17e2ca71b4f6db76a4848d366defa36f1b19bdd7 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 18 Feb 2011 14:15:10 +0100 Subject: Logging of duplicit identities added Signed-off-by: Martin Sustrik --- src/ctx.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/ctx.cpp') diff --git a/src/ctx.cpp b/src/ctx.cpp index 024e813..84f9b03 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -291,14 +291,22 @@ zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_) return *endpoint; } -void zmq::ctx_t::log (zmq_msg_t *msg_) +void zmq::ctx_t::log (const char *format_, va_list args_) { + // Create the log message. + zmq_msg_t msg; + int rc = zmq_msg_init_size (&msg, strlen (format_) + 1); + zmq_assert (rc == 0); + memcpy (zmq_msg_data (&msg), format_, zmq_msg_size (&msg)); + // At this point we migrate the log socket to the current thread. // We rely on mutex for executing the memory barrier. log_sync.lock (); if (log_socket) - log_socket->send (msg_, 0); + log_socket->send (&msg, 0); log_sync.unlock (); + + zmq_msg_close (&msg); } -- cgit v1.2.3