diff options
| author | 2019-10-09 17:36:17 +0100 | |
|---|---|---|
| committer | 2019-10-09 17:36:17 +0100 | |
| commit | f721cf848ab06009c4317431c2b13f90d8832350 (patch) | |
| tree | e6680ce23ca397866c9f0097f0ff7865312d664a /src | |
| parent | format multi-line toots on a single line using things like double space (diff) | |
| signature | ||
stdout output should just be WARN - put INFO in to a daily file
this is because stdout, in something like systemd, will mess up journalctl output.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Logging.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Logging.py b/src/Logging.py index 2de6de3d..94114a51 100644 --- a/src/Logging.py +++ b/src/Logging.py @@ -29,7 +29,7 @@ class Log(object): formatter = BitBotFormatter("%(asctime)s [%(levelname)s] %(message)s") stdout_handler = logging.StreamHandler(sys.stdout) - stdout_handler.setLevel(stdout_level) + stdout_handler.setLevel(LEVELS["warn"]) stdout_handler.setFormatter(formatter) self.logger.addHandler(stdout_handler) @@ -41,6 +41,13 @@ class Log(object): trace_handler.setFormatter(formatter) self.logger.addHandler(trace_handler) + info_path = os.path.join(location, "info.log") + info_handler = logging.handlers.TimedRotatingFileHandler( + info_path, when="midnight", backupCount=0) + info_handler.setLevel(LEVELS["info"]) + info_handler.setFormatter(formatter) + self.logger.addHandler(info_handler) + warn_path = os.path.join(location, "warn.log") warn_handler = logging.FileHandler(warn_path) warn_handler.setLevel(LEVELS["warn"]) |
