commit 5ec47fdc07850c01b5abe79461111c7d07812ded from: Tracey Emery date: Fri Jul 17 19:35:46 2020 UTC fix logging level and add debug commit - d93e927bb748a10d06c296103974809a318fd9c4 commit + 5ec47fdc07850c01b5abe79461111c7d07812ded blob - a64a87902575ad1f92369287f20c21322afcc576 blob + 324b35b44b121490745789d40d457af8f53d289b --- thingsctl/parser.c +++ thingsctl/parser.c @@ -63,6 +63,7 @@ static const struct token t_main[] = { }; static const struct token t_log[] = { + {KEYWORD, "debug", LOG_DEBUG, NULL}, {KEYWORD, "verbose", LOG_VERBOSE, NULL}, {KEYWORD, "brief", LOG_BRIEF, NULL}, {ENDTOKEN, "", NONE, NULL} blob - 86a870e5320549a499e6dc4cd49a62bfd9a3a4b0 blob + 0e376804e4d9e81ca36283ca26bacf9beda1daa5 --- thingsctl/parser.h +++ thingsctl/parser.h @@ -19,6 +19,7 @@ enum actions { NONE, LIST, LIST_THINGS, + LOG_DEBUG, LOG_VERBOSE, LOG_BRIEF, SHOW, blob - 066ff771ab9ed263b4d7cd9f247662e6386395c2 blob + a743e98a09278ad32b41df19b4150cfb8788c3c1 --- thingsctl/thingsctl.c +++ thingsctl/thingsctl.c @@ -111,15 +111,18 @@ main(int argc, char *argv[]) imsg_compose(ibuf, IMSG_GET_INFO_THINGS_REQUEST, 0, 0, -1, res->name, sizeof(res->name)); break; + case LOG_DEBUG: + verbose++; + /* FALLTHROUGH */ + case LOG_VERBOSE: + verbose++; + /* FALLTHROUGH */ case LOG_BRIEF: imsg_compose(ibuf, IMSG_CTL_VERBOSE, 0, 0, -1, &verbose, sizeof(verbose)); printf("logging request sent.\n"); done = 1; break; - case LOG_VERBOSE: - verbose = 1; - /* FALLTHROUGH */ case SHOW_CONTROL: imsg_compose(ibuf, IMSG_GET_INFO_CONTROL_REQUEST, 0, 0, -1, NULL, 0); @@ -185,8 +188,14 @@ show_parent_msg(struct imsg *imsg) switch (imsg->hdr.type) { case IMSG_GET_INFO_PARENT_DATA: npi = imsg->data; - printf("parent says: '%s' (%s)\n", npi->text, - npi->verbose ? "verbose" : "brief"); + printf("parent says: Logging level is "); + if (npi->verbose == 2) + printf("debug"); + else if (npi->verbose == 1) + printf("verbose"); + else + printf("brief"); + printf(" (%d)\n", npi->verbose); break; case IMSG_GET_INFO_PARENT_END_DATA: case IMSG_CTL_END: @@ -228,9 +237,14 @@ show_control_msg(struct imsg *imsg) switch (imsg->hdr.type) { case IMSG_GET_INFO_CONTROL_DATA: nci = imsg->data; - printf("control says: '%s'", - nci->verbose ? "verbose" : "brief"); - printf("\n"); + printf("parent says: Logging level is "); + if (nci->verbose == 2) + printf("debug"); + else if (nci->verbose == 1) + printf("verbose"); + else + printf("brief"); + printf(" (%d)\n", nci->verbose); break; case IMSG_GET_INFO_CONTROL_END_DATA: case IMSG_CTL_END: blob - df86653a0ab3d5e1b26cb0f84c1de844d30852b1 blob + 89acbb127f1ddbcd515113dc116d59d99307e79d --- thingsd/control.c +++ thingsd/control.c @@ -356,6 +356,7 @@ control_dispatch_imsg(int fd, short event, void *arg) c->flags |= CTL_CONN_NOTIFY; break; case IMSG_CTL_VERBOSE: + log_info("%s", __func__); IMSG_SIZE_CHECK(&imsg, &v); memcpy(&v, imsg.data, sizeof(v)); @@ -381,6 +382,7 @@ control_dispatch_imsg(int fd, short event, void *arg) IMSG_GET_INFO_THINGS_REQUEST) imsg.hdr.type = IMSG_GET_INFO_THINGS_REQUEST_ROOT; + if (proc_compose_imsg(ps, PROC_PARENT, -1, imsg.hdr.type, imsg.hdr.peerid, -1, imsg.data, IMSG_DATA_SIZE(&imsg)) == -1) { blob - 250d3fe195bf57b01a2f3bc771b47b6c794db183 blob + 22886ef3495a9f58e53a5c6973665361e89c011d --- thingsd/proc.c +++ thingsd/proc.c @@ -660,6 +660,7 @@ proc_dispatch(int fd, short event, void *arg) */ switch (imsg.hdr.type) { case IMSG_CTL_VERBOSE: + log_info("%s", __func__); IMSG_SIZE_CHECK(&imsg, &verbose); memcpy(&verbose, imsg.data, sizeof(verbose)); log_setverbose(verbose); blob - 393ab823c6fa426e07f437d600d2dccd999ee02c blob + 65003f3488a38e9a54c3c1ea34cb1d98846fb6ca --- thingsd/things.c +++ thingsd/things.c @@ -180,6 +180,7 @@ things_dispatch_parent(int fd, struct privsep_proc *p, config_getreset(thingsd_env, imsg); break; case IMSG_CTL_VERBOSE: + log_info("%s", __func__); IMSG_SIZE_CHECK(imsg, &verbose); memcpy(&verbose, imsg->data, sizeof(verbose)); log_setverbose(verbose); blob - fb261b78df7f4a8dd708194afd79e41857d52ec4 blob + fa84804a0a90eb3774861b8afd16014ff2045502 --- thingsd/thingsd.c +++ thingsd/thingsd.c @@ -90,6 +90,7 @@ thingsd_dispatch_control(int fd, struct privsep_proc * thingsd_reload(v); break; case IMSG_CTL_VERBOSE: + log_info("%s", __func__); IMSG_SIZE_CHECK(imsg, &verbose); memcpy(&verbose, imsg->data, sizeof(verbose)); log_setverbose(verbose);