summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/cons/cons.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/cons/cons.c b/modules/cons/cons.c
index 89ce028..f652a75 100644
--- a/modules/cons/cons.c
+++ b/modules/cons/cons.c
@@ -212,6 +212,17 @@ static int output_handler(const char *str)
}
+/*
+ * Relay log-messages to all active UDP/TCP connections
+ */
+static void log_handler(uint32_t level, const char *msg)
+{
+ (void)level;
+
+ output_handler(msg);
+}
+
+
static struct ui ui_cons = {
LE_INIT,
"cons",
@@ -219,6 +230,11 @@ static struct ui ui_cons = {
};
+static struct log lg = {
+ .h = log_handler,
+};
+
+
static int cons_init(void)
{
struct sa laddr;
@@ -234,12 +250,16 @@ static int cons_init(void)
ui_register(&ui_cons);
+ log_register_handler(&lg);
+
return 0;
}
static int cons_close(void)
{
+ log_unregister_handler(&lg);
+
ui_unregister(&ui_cons);
cons = mem_deref(cons);
return 0;