diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-06-06 14:45:41 +0200 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-06-08 10:27:06 +0200 |
commit | 30fdcceea3efbd264b00d78fb0f86fd5a2ff8831 (patch) | |
tree | ce0f5c1cf19fd19049ee5d51bdb8137c1bc974b2 /src/utils/cache.py | |
parent | 1ab981a539f3553021b3cf1642619338f2782af1 (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/utils/cache.py')
-rw-r--r-- | src/utils/cache.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utils/cache.py b/src/utils/cache.py index 150a5df..3bd4053 100644 --- a/src/utils/cache.py +++ b/src/utils/cache.py @@ -6,6 +6,7 @@ # Free Software Foundation; either version 3 of the License, or # (at your option) any later version. +import logging import os from src.utils.fs import mount_mkdir, umount @@ -45,7 +46,7 @@ def write_cache_txt(content): """ client_ip = getifaddr(os.getenv('DEVICE')) with open(OGCLIENT_LOG_CACHE.format(ip=client_ip), 'w') as f: - print("About to write") + logging.debug('Writing cache contents to %s.cache.txt', client_ip) f.write(content) def generate_cache_txt(): |