diff options
author | Felix Fietkau <nbd@nbd.name> | 2023-01-19 13:06:19 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2023-01-19 13:06:21 +0100 |
commit | cc34fb7b922f183e6ece5fa0fec31d4eb95c5823 (patch) | |
tree | 84dfeebce2ee9239552361125b593a4a1f431f88 | |
parent | 4c7b720b9c63b826fb9404e454ae54f2ef5649d5 (diff) | |
download | ubox-master.tar.gz |
Provides easier access to log messages
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r-- | log/logd.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -207,7 +207,7 @@ ubus_notify_log(struct log_head *l) { struct client *c; - if (list_empty(&clients)) + if (list_empty(&clients) && !log_object.has_subscribers) return; blob_buf_init(&b, 0); @@ -217,6 +217,9 @@ ubus_notify_log(struct log_head *l) blobmsg_add_u32(&b, "source", l->source); blobmsg_add_u64(&b, "time", (((__u64) l->ts.tv_sec) * 1000) + (l->ts.tv_nsec / 1000000)); + if (log_object.has_subscribers) + ubus_notify(&conn.ctx, &log_object, "message", b.head, -1); + list_for_each_entry(c, &clients, list) ustream_write(&c->s.stream, (void *) b.head, blob_len(b.head) + sizeof(struct blob_attr), false); |