diff mbox series

[v2,2/5] Enable tracing for early start up code

Message ID 20210129115155.13116-3-michael.adler@siemens.com
State Accepted
Headers show
Series Overhaul swupdate.cfg handling | expand

Commit Message

Michael Adler Jan. 29, 2021, 11:51 a.m. UTC
The current behavior is to set the log level in the *second*
getopt_long(3) parsing stage of SWUpdate. In other words, all log
messages with a finer granularity (e.g. INFO) which are created *before*
reaching the second getopt parsing stage are dropped since the default
log level is ERROR. This makes it (unneccesarily) difficult to debug
issues in the swupdate.cfg parsing code.
To allow for config overloading, we continue to parse the loglevel a
second time after loading and parsing swupdate.cfg.

Signed-off-by: Michael Adler <michael.adler@siemens.com>
Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 core/swupdate.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/core/swupdate.c b/core/swupdate.c
index 4f008e0..788981e 100644
--- a/core/swupdate.c
+++ b/core/swupdate.c
@@ -516,6 +516,12 @@  int main(int argc, char **argv)
 		case 'f':
 			cfgfname = sdup(optarg);
 			break;
+		case 'l':
+			loglevel = strtoul(optarg, NULL, 10);
+			break;
+		case 'v':
+			loglevel = TRACELEVEL;
+			break;
 		case '0':
 			printf("%s", BANNER);
 			exit(EXIT_SUCCESS);