From 3d1568783e85378a88dde268b68545f0da968d52 Mon Sep 17 00:00:00 2001 From: mrpabloyeah Date: Sun, 13 Apr 2025 01:39:03 +0200 Subject: [PATCH] Allow warning messages when starting backtesting --- freqtrade/mixins/logging_mixin.py | 12 ++++++++---- freqtrade/optimize/backtesting.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/freqtrade/mixins/logging_mixin.py b/freqtrade/mixins/logging_mixin.py index 58399e738..e9a30d471 100644 --- a/freqtrade/mixins/logging_mixin.py +++ b/freqtrade/mixins/logging_mixin.py @@ -9,8 +9,8 @@ class LoggingMixin: Shows similar messages only once every `refresh_period`. """ - # Disable output completely - show_output = True + # Disable INFO output when False + show_info_output = True def __init__(self, logger, refresh_period: int = 3600): """ @@ -35,6 +35,10 @@ class LoggingMixin: # Log as debug first self.logger.debug(message) - # Call hidden function. - if self.show_output: + + # Determine if this is an INFO level message + is_info_message = getattr(logmethod, "__name__", "") == "info" + + # For INFO messages, respect show_info_output flag + if not is_info_message or self.show_info_output: _log_once(message) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 9326c0840..92a9cf261 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -114,7 +114,7 @@ class Backtesting: """ def __init__(self, config: Config, exchange: Exchange | None = None) -> None: - LoggingMixin.show_output = False + LoggingMixin.show_info_output = False self.config = config self.results: BacktestResultType = get_BacktestResultType_default() self.trade_id_counter: int = 0 @@ -235,7 +235,7 @@ class Backtesting: @staticmethod def cleanup(): - LoggingMixin.show_output = True + LoggingMixin.show_info_output = True enable_database_use() def init_backtest_detail(self) -> None: