33Moler related configuration
44"""
55__author__ = "Grzegorz Latuszek, Marcin Usielski, Michal Ernst, Tomasz Krol"
6- __copyright__ = "Copyright (C) 2018-2022 , Nokia"
6+ __copyright__ = "Copyright (C) 2018-2026 , Nokia"
77__email__ = "grzegorz.latuszek@nokia.com, marcin.usielski@nokia.com, michal.ernst@nokia.com, tomasz.krol@nokia.com"
88import os
99from contextlib import contextmanager
@@ -267,22 +267,7 @@ def load_logger_from_config(config):
267267 log_cfg .configure_moler_main_logger ()
268268
269269
270- def _config_rotating (config ):
271- if "KIND" in config ["LOGGER" ]:
272- print (
273- "Warning! Please update LOGGER to new style. 'KIND' should now exist in LOG_ROTATION section."
274- ) # Logger is not available here.
275- log_cfg .set_kind (config ["LOGGER" ]["KIND" ])
276- if "INTERVAL" in config ["LOGGER" ]:
277- print (
278- "Warning! Please update LOGGER to new style. 'INTERVAL' should now exist in LOG_ROTATION section."
279- ) # Logger is not available here.
280- log_cfg .set_interval (config ["LOGGER" ]["INTERVAL" ])
281- if "BACKUP_COUNT" in config ["LOGGER" ]:
282- print (
283- "Warning! Please update LOGGER to new style. 'BACKUP_COUNT' should now exist in LOG_ROTATION section."
284- ) # Logger is not available here.
285- log_cfg .set_backup_count (config ["LOGGER" ]["BACKUP_COUNT" ])
270+ def _update_config_log_rotation (config : dict ) -> None :
286271 if "LOG_ROTATION" in config ["LOGGER" ]:
287272 log_rotation = config ["LOGGER" ]["LOG_ROTATION" ]
288273 if "KIND" in log_rotation :
@@ -300,6 +285,25 @@ def _config_rotating(config):
300285 log_cfg .set_compressed_file_extension (
301286 log_rotation ["COMPRESSED_FILE_EXTENSION" ]
302287 )
288+
289+
290+ def _config_rotating (config ):
291+ if "KIND" in config ["LOGGER" ]:
292+ print (
293+ "Warning! Please update LOGGER to new style. 'KIND' should now exist in LOG_ROTATION section."
294+ ) # Logger is not available here.
295+ log_cfg .set_kind (config ["LOGGER" ]["KIND" ])
296+ if "INTERVAL" in config ["LOGGER" ]:
297+ print (
298+ "Warning! Please update LOGGER to new style. 'INTERVAL' should now exist in LOG_ROTATION section."
299+ ) # Logger is not available here.
300+ log_cfg .set_interval (config ["LOGGER" ]["INTERVAL" ])
301+ if "BACKUP_COUNT" in config ["LOGGER" ]:
302+ print (
303+ "Warning! Please update LOGGER to new style. 'BACKUP_COUNT' should now exist in LOG_ROTATION section."
304+ ) # Logger is not available here.
305+ log_cfg .set_backup_count (config ["LOGGER" ]["BACKUP_COUNT" ])
306+ _update_config_log_rotation (config )
303307 if "CONSOLE_LOGS" in config ["LOGGER" ]:
304308 for logger_name in config ["LOGGER" ]["CONSOLE_LOGS" ]:
305309 log_cfg .add_console_log (logger_name )
0 commit comments