On 11/07/17 17:55, Ron Brash wrote:
After wanting to filter logs at the logger level, instead of post
log-write, we added
a feature such that we can filter within the logd daemon itself.
sorry for the late review ...
Signed-off-by: “Ron Brash <“ron.br...@gmail.com”>
---
log/logd.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/log/logd.c b/log/logd.c
index 07aee2b..5b99fdf 100644
--- a/log/logd.c
+++ b/log/logd.c
@@ -27,6 +27,7 @@
#include "syslog.h"
int debug = 0;
+int priority = 0;
make this static and remove the = 0
static struct blob_buf b;
static struct ubus_auto_conn conn;
static LIST_HEAD(clients);
@@ -182,6 +183,9 @@ ubus_notify_log(struct log_head *l)
if (list_empty(&clients))
return;
+ if((l->priority & 7) > priority) {
+ return;
+ }
drop the brackets please and use the LOG_PRI() macro please
blob_buf_init(&b, 0);
blobmsg_add_string(&b, "msg", l->data);
blobmsg_add_u32(&b, "id", l->id);
@@ -214,13 +218,21 @@ main(int argc, char **argv)
int ch, log_size = 16;
signal(SIGPIPE, SIG_IGN);
- while ((ch = getopt(argc, argv, "S:")) != -1) {
+ while ((ch = getopt(argc, argv, "P:S:")) != -1) {
switch (ch) {
case 'S':
log_size = atoi(optarg);
if (log_size < 1)
log_size = 16;
break;
+ case 'P':
+ priority = atoi(optarg);
+ if (priority < 0) {
+ priority = 0;
+ } else if (priority > 7) {
+ priority = 7;
+ }
you can probably drop the validation. if the users passes 9 as a
priority everything will be logged. passing -1 will cause silent logging.
John
+ break;
}
}
log_size *= 1024;
_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev
_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev