From 30fdcceea3efbd264b00d78fb0f86fd5a2ff8831 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Mon, 6 Jun 2022 14:45:41 +0200 Subject: src: improve logging Adds new logging handler redirecting messages to the log file located in the Samba shared directory (applies to live mode clients, i.e: ogLive) Parses log level configuration from ogclient.json. See: { "opengnsys": { ... "log": "INFO", ... } ... } Adds --debug option to set root logger level to DEBUG when starting ogClient. Overrides log level from config file. In addition: - Replaces any occurence of print with a corresponding logging function. - Unsets log level for handlers, use root logger level instead. - Default level for root logger is INFO. - Replaces level from response log messages to debug (ogRest) --- src/ogRest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ogRest.py') diff --git a/src/ogRest.py b/src/ogRest.py index 0207af0..8e54612 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -60,7 +60,7 @@ class restResponse(): return self.msg if response in {ogResponses.OK, ogResponses.IN_PROGRESS}: - LOGGER.info(self.msg[:ogRest.LOG_LENGTH]) + LOGGER.debug(self.msg[:ogRest.LOG_LENGTH]) else: LOGGER.warn(self.msg[:ogRest.LOG_LENGTH]) @@ -281,7 +281,7 @@ class ogRest(): method = request.get_method() URI = request.get_uri() - LOGGER.debug('%s%s', method, URI[:ogRest.LOG_LENGTH]) + LOGGER.debug('Incoming request: %s%s', method, URI[:ogRest.LOG_LENGTH]) if (not "stop" in URI and not "reboot" in URI and -- cgit v1.2.3-18-g5258