fix: enforce unbuffered logging and verify hybrid exit strategy success
This commit is contained in:
@@ -14,13 +14,18 @@ from src.execution.manager import ExecutionManager
|
||||
from scripts.find_isa_candidates import find_best_isa_tickers
|
||||
from scripts.backtest import backtest_ticker
|
||||
|
||||
# Force flush handler to ensure bot logs are written to disk immediately
|
||||
class FlushHandler(logging.FileHandler):
|
||||
def emit(self, record):
|
||||
super().emit(record)
|
||||
self.flush()
|
||||
|
||||
# Ensure logs directory exists
|
||||
os.makedirs("logs", exist_ok=True)
|
||||
log_filename = datetime.now().strftime("logs/bot_%Y-%m-%d.log")
|
||||
|
||||
# Configure logging to both console and file
|
||||
# Use a specific handler setup to enable manual flushing
|
||||
file_handler = logging.FileHandler(log_filename)
|
||||
file_handler = FlushHandler(log_filename)
|
||||
stream_handler = logging.StreamHandler()
|
||||
|
||||
logging.basicConfig(
|
||||
|
||||
Reference in New Issue
Block a user