diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-02-18 14:15:10 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-02-18 14:15:10 +0100 |
commit | 17e2ca71b4f6db76a4848d366defa36f1b19bdd7 (patch) | |
tree | 91cf1d4b619e245553f4bcc7b5b10ce2574cf815 /src/ctx.cpp | |
parent | 1f536b2d3820ba5435086a77ad34d86a432b94c7 (diff) |
Logging of duplicit identities added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/ctx.cpp')
-rw-r--r-- | src/ctx.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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); } |