logs to default_logger

This commit is contained in:
Vasily.onl
2025-06-04 17:03:35 +08:00
parent e57c33014f
commit 344c029f25
20 changed files with 149 additions and 152 deletions

View File

@@ -15,7 +15,7 @@ from components.charts.config import get_all_example_strategies
from database.connection import DatabaseManager
from dash import html
logger = get_logger("chart_callbacks")
logger = get_logger("default_logger")
def register_chart_callbacks(app):
@@ -36,7 +36,7 @@ def register_chart_callbacks(app):
# If a strategy is selected, use strategy chart
if selected_strategy and selected_strategy != 'basic':
fig = create_strategy_chart(symbol, timeframe, selected_strategy)
logger.debug(f"Created strategy chart for {symbol} ({timeframe}) with strategy: {selected_strategy}")
logger.debug(f"Chart callback: Created strategy chart for {symbol} ({timeframe}) with strategy: {selected_strategy}")
else:
# Create chart with dynamically selected indicators
fig = create_chart_with_indicators(
@@ -48,7 +48,7 @@ def register_chart_callbacks(app):
)
indicator_count = len(overlay_indicators or []) + len(subplot_indicators or [])
logger.debug(f"Created dynamic chart for {symbol} ({timeframe}) with {indicator_count} indicators")
logger.debug(f"Chart callback: Created dynamic chart for {symbol} ({timeframe}) with {indicator_count} indicators")
return fig
@@ -82,14 +82,14 @@ def register_chart_callbacks(app):
for subplot_config in config.subplot_configs or []:
subplot_indicators.extend(subplot_config.indicators or [])
logger.debug(f"Loaded strategy {selected_strategy}: {len(overlay_indicators)} overlays, {len(subplot_indicators)} subplots")
logger.debug(f"Chart callback: Loaded strategy {selected_strategy}: {len(overlay_indicators)} overlays, {len(subplot_indicators)} subplots")
return overlay_indicators, subplot_indicators
else:
logger.warning(f"Strategy {selected_strategy} not found")
logger.warning(f"Chart callback: Strategy {selected_strategy} not found")
return [], []
except Exception as e:
logger.error(f"Error loading strategy indicators: {e}")
logger.error(f"Chart callback: Error loading strategy indicators: {e}")
return [], []
# Market statistics callback
@@ -115,7 +115,7 @@ def register_chart_callbacks(app):
])
except Exception as e:
logger.error(f"Error updating market stats: {e}")
logger.error(f"Chart callback: Error updating market stats: {e}")
return html.Div("Error loading market statistics")
logger.info("Chart callbacks registered successfully")
logger.info("Chart callback: Chart callbacks registered successfully")

View File

@@ -7,7 +7,7 @@ from dash import Output, Input, State, html, dcc, callback_context
import json
from utils.logger import get_logger
logger = get_logger("indicator_callbacks")
logger = get_logger("default_logger")
def register_indicator_callbacks(app):
@@ -282,7 +282,7 @@ def register_indicator_callbacks(app):
return success_msg, overlay_options, subplot_options
except Exception as e:
logger.error(f"Error saving indicator: {e}")
logger.error(f"Indicator callback: Error saving indicator: {e}")
error_msg = html.Div([
html.Span("", style={'color': '#dc3545'}),
html.Span(f"Error: {str(e)}", style={'color': '#dc3545'})
@@ -475,7 +475,7 @@ def register_indicator_callbacks(app):
return error_msg, dash.no_update, dash.no_update
except Exception as e:
logger.error(f"Error deleting indicator: {e}")
logger.error(f"Indicator callback: Error deleting indicator: {e}")
error_msg = html.Div([
html.Span("", style={'color': '#dc3545'}),
html.Span(f"Error: {str(e)}", style={'color': '#dc3545'})
@@ -572,7 +572,7 @@ def register_indicator_callbacks(app):
return dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update
except Exception as e:
logger.error(f"Error loading indicator for edit: {e}")
logger.error(f"Indicator callback: Error loading indicator for edit: {e}")
return dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update
# Reset modal form when closed
@@ -603,4 +603,4 @@ def register_indicator_callbacks(app):
return "", None, "", "#007bff", 2, "📊 Add New Indicator", None, 20, 12, 14, 12, 26, 9, 20, 2.0
return dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update, dash.no_update
logger.info("Indicator callbacks registered successfully")
logger.info("Indicator callbacks: registered successfully")

View File

@@ -8,7 +8,7 @@ from utils.logger import get_logger
from database.connection import DatabaseManager
from components.charts import create_data_status_indicator, check_data_availability
logger = get_logger("system_health_callbacks")
logger = get_logger("default_logger")
def register_system_health_callbacks(app):
@@ -40,7 +40,7 @@ def register_system_health_callbacks(app):
])
except Exception as e:
logger.error(f"Database status check failed: {e}")
logger.error(f"System health callback: Database status check failed: {e}")
return html.Div([
html.Span("🔴 Connection Failed", style={'color': '#e74c3c', 'font-weight': 'bold'}),
html.P(f"Error: {str(e)}", style={'color': '#7f8c8d', 'font-size': '12px'})
@@ -68,7 +68,7 @@ def register_system_health_callbacks(app):
], style={'background-color': '#f8f9fa', 'padding': '15px', 'border-radius': '5px'})
except Exception as e:
logger.error(f"Error updating data status: {e}")
logger.error(f"System health callback: Error updating data status: {e}")
return html.Div([
html.Span("🔴 Status Check Failed", style={'color': '#e74c3c', 'font-weight': 'bold'}),
html.P(f"Error: {str(e)}", style={'color': '#7f8c8d', 'margin': '5px 0'})
@@ -87,10 +87,10 @@ def register_system_health_callbacks(app):
html.P("Redis integration pending", style={'color': '#7f8c8d', 'margin': '5px 0'})
])
except Exception as e:
logger.error(f"Redis status check failed: {e}")
logger.error(f"System health callback: Redis status check failed: {e}")
return html.Div([
html.Span("🔴 Check Failed", style={'color': '#e74c3c', 'font-weight': 'bold'}),
html.P(f"Error: {str(e)}", style={'color': '#7f8c8d', 'font-size': '12px'})
])
logger.info("System health callbacks registered successfully")
logger.info("System health callback: System health callbacks registered successfully")

View File

@@ -5,7 +5,7 @@ Chart control components for the market data layout.
from dash import html, dcc
from utils.logger import get_logger
logger = get_logger("chart_controls")
logger = get_logger("default_logger")
def create_chart_config_panel(strategy_options, overlay_options, subplot_options):

View File

@@ -13,7 +13,7 @@ from dashboard.components.chart_controls import (
create_auto_update_control
)
logger = get_logger("market_data_layout")
logger = get_logger("default_logger")
def get_market_data_layout():
@@ -72,7 +72,7 @@ def get_market_data_layout():
subplot_options.append({'label': display_name, 'value': indicator.id})
except Exception as e:
logger.warning(f"Error loading indicator options: {e}")
logger.warning(f"Market data layout: Error loading indicator options: {e}")
strategy_options = [{'label': 'Basic Chart', 'value': 'basic'}]
overlay_options = []
subplot_options = []