Allow warning messages when starting backtesting

This commit is contained in:
mrpabloyeah
2025-04-13 01:39:03 +02:00
parent 82cd343fc1
commit 3d1568783e
2 changed files with 10 additions and 6 deletions

View File

@@ -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)

View File

@@ -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: