From f1788f057f606e26d5bb216c4ebd7d1a81d91116 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 19 Nov 2025 17:42:47 +0900 Subject: [PATCH] Log skip format change it format flags have not changed --- src/corelibs/logging_handling/log.py | 5 +++++ test-run/logging_handling/log.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/corelibs/logging_handling/log.py b/src/corelibs/logging_handling/log.py index 15bdea5..22c51f8 100644 --- a/src/corelibs/logging_handling/log.py +++ b/src/corelibs/logging_handling/log.py @@ -731,6 +731,7 @@ class Log(LogParent): # formatter_console = logging.Formatter(format_string, datefmt=format_date) formatter_console = logging.Formatter(format_string) self.__set_time_format_for_console_formatter(formatter_console, console_format_type) + self.log_settings['console_format_type'] = console_format_type return formatter_console # MARK: console handler update @@ -744,8 +745,12 @@ class Log(LogParent): Arguments: console_format_type {ConsoleFormat} -- _description_ """ + # skip if console not enabled if not self.log_settings['console_enabled']: return + # skip if format has not changed + if self.log_settings['console_format_type'] == console_format_type: + return # update the formatter self.handlers[self.CONSOLE_HANDLER].setFormatter( self.__set_console_formatter(console_format_type) diff --git a/test-run/logging_handling/log.py b/test-run/logging_handling/log.py index 2a11213..e1bd095 100644 --- a/test-run/logging_handling/log.py +++ b/test-run/logging_handling/log.py @@ -113,6 +113,8 @@ def main(): log.debug('Current logging format: %s', log.log_settings['console_format_type']) log.update_console_formatter(ConsoleFormat.TIME | ConsoleFormat.LINENO) log.info('Does hit show less') + log.update_console_formatter(ConsoleFormat.TIME | ConsoleFormat.LINENO) + log.info('Does hit show less B') if __name__ == "__main__":