{
struct blob_attr *tb[__LOG_MAX];
struct stat s;
- char buf[512];
+ char buf[LOG_LINE_SIZE + 128];
char buf_ts[32];
uint32_t p;
- char *str;
time_t t;
uint32_t t_ms = 0;
char *c, *m;
c = ctime(&t);
p = blobmsg_get_u32(tb[LOG_PRIO]);
c[strlen(c) - 1] = '\0';
- str = blobmsg_format_json(msg, true);
+
if (log_type == LOG_NET) {
int err;
ret = write(sender.fd, buf, strlen(buf));
}
- free(str);
if (log_type == LOG_FILE)
fsync(sender.fd);
log_notify(a);
ustream_consume(s, cur_len);
}
- if (!log_follow)
- uloop_end();
+}
+
+static void logread_fd_state_cb(struct ustream *s)
+{
+ uloop_end();
}
static void logread_fd_cb(struct ubus_request *req, int fd)
static struct ustream_fd test_fd;
test_fd.stream.notify_read = logread_fd_data_cb;
+ test_fd.stream.notify_state = logread_fd_state_cb;
ustream_fd_init(&test_fd, fd);
}
blob_buf_init(&b, 0);
blobmsg_add_u8(&b, "stream", 1);
+ blobmsg_add_u8(&b, "oneshot", !log_follow);
if (lines)
blobmsg_add_u32(&b, "lines", lines);
else if (log_follow)