summaryrefslogtreecommitdiffstats
path: root/src/restRequest.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2022-06-06 14:45:41 +0200
committerJose M. Guisado <jguisado@soleta.eu>2022-06-08 10:27:06 +0200
commit30fdcceea3efbd264b00d78fb0f86fd5a2ff8831 (patch)
treece0f5c1cf19fd19049ee5d51bdb8137c1bc974b2 /src/restRequest.py
parent1ab981a539f3553021b3cf1642619338f2782af1 (diff)
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)
Diffstat (limited to 'src/restRequest.py')
-rw-r--r--src/restRequest.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/restRequest.py b/src/restRequest.py
index 9a9c624..61d64c6 100644
--- a/src/restRequest.py
+++ b/src/restRequest.py
@@ -7,8 +7,10 @@
# (at your option) any later version.
import email
-from io import StringIO
import json
+import logging
+
+from io import StringIO
class restRequest:
def __init__(self):
@@ -57,7 +59,7 @@ class restRequest:
try:
json_param = json.loads(body)
except ValueError as e:
- print ("Error: Json message incomplete")
+ logging.error("JSON message incomplete")
return
if "run" in json_param: