From 91126505104798f4283d5e6e9291fbc1824bbec2 Mon Sep 17 00:00:00 2001 From: Robert Goldmann <deadlocker@gmx.de> Date: Sun, 15 May 2022 20:45:31 +0200 Subject: [PATCH] added optional rotating file handler --- .gitignore | 1 + config/settings-example.json | 6 ++++++ src/DashboardLeaf.py | 8 ++++++++ src/version.json | 6 +++--- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 08b45e7..88eb1f2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /config .idea/ /*.ics +DashboardLeaf.log* diff --git a/config/settings-example.json b/config/settings-example.json index f32efc7..cd71316 100644 --- a/config/settings-example.json +++ b/config/settings-example.json @@ -6,5 +6,11 @@ "useSSL": false, "keyfile": "", "certfile": "" + }, + "logging": { + "enableRotatingLogFile": false, + "fileName": "DashboardLeaf.log", + "maxBytes": 2097152, + "numberOfBackups": 3 } } \ No newline at end of file diff --git a/src/DashboardLeaf.py b/src/DashboardLeaf.py index 596799d..0da8f58 100644 --- a/src/DashboardLeaf.py +++ b/src/DashboardLeaf.py @@ -19,6 +19,14 @@ class DashboardLeaf(FlaskBaseApp): def __init__(self, appName: str): super().__init__(appName, os.path.dirname(__file__), LOGGER, serveRobotsTxt=True, settingsPath=os.path.join(CONFIG_DIR, 'settings.json')) + + loggingSettings = self._settings['logging'] + if loggingSettings['enableRotatingLogFile']: + DefaultLogger.add_rotating_file_handler(LOGGER, + fileName=loggingSettings['fileName'], + maxBytes=loggingSettings['maxBytes'], + backupCount=loggingSettings['numberOfBackups']) + self._tileService = None self._pageManager = None ServiceRegistry.get_instance() diff --git a/src/version.json b/src/version.json index fc0e3ea..328402d 100644 --- a/src/version.json +++ b/src/version.json @@ -1,7 +1,7 @@ { "version": { - "name": "v1.14.0", - "code": 21, - "date": "11.10.21" + "name": "v1.15.0", + "code": 22, + "date": "15.05.21" } } \ No newline at end of file -- GitLab