summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ctx.cpp9
-rw-r--r--src/ctx.hpp3
-rw-r--r--src/object.cpp5
-rw-r--r--src/object.hpp3
4 files changed, 19 insertions, 1 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp
index 437feed..97398ae 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -307,6 +307,13 @@ zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_)
return *endpoint;
}
-// The last used socket ID, or 0 if no socket was used so far.
+void zmq::ctx_t::log (int sid_, const char *text_)
+{
+ monitor->log (sid_, text_);
+}
+
+// The last used socket ID, or 0 if no socket was used so far. Note that this
+// is a global variable. Thus, even sockets created in different contexts have
+// unique IDs.
zmq::atomic_counter_t zmq::ctx_t::max_socket_id;
diff --git a/src/ctx.hpp b/src/ctx.hpp
index 59d753e..876b53c 100644
--- a/src/ctx.hpp
+++ b/src/ctx.hpp
@@ -93,6 +93,9 @@ namespace zmq
void unregister_endpoints (zmq::socket_base_t *socket_);
endpoint_t find_endpoint (const char *addr_);
+ // Logging.
+ void log (int sid_, const char *text_);
+
enum {
term_tid = 0,
reaper_tid = 1
diff --git a/src/object.cpp b/src/object.cpp
index 04044d3..c9eb3dd 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -154,6 +154,11 @@ zmq::io_thread_t *zmq::object_t::choose_io_thread (uint64_t affinity_)
return ctx->choose_io_thread (affinity_);
}
+void zmq::object_t::log (int sid_, const char *text_)
+{
+ ctx->log (sid_, text_);
+}
+
void zmq::object_t::send_stop ()
{
// 'stop' command goes always from administrative thread to
diff --git a/src/object.hpp b/src/object.hpp
index 791a7e3..d6d55ae 100644
--- a/src/object.hpp
+++ b/src/object.hpp
@@ -64,6 +64,9 @@ namespace zmq
// Chooses least loaded I/O thread.
zmq::io_thread_t *choose_io_thread (uint64_t affinity_);
+ // Log a message.
+ void log (int sid_, const char *text_);
+
// Derived object can use these functions to send commands
// to other objects.
void send_stop ();