#!/usr/bin/env python3 """ Test script to verify fixed hedger logging """ import os import sys # Add current directory to Python path current_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(current_dir) try: # Import the hedger to test its logging from clp_scalper_hedger import ScalperHedger print("✅ Successfully imported ScalperHedger") print("This should have triggered logging setup and created log files") # Check if log file was created logs_dir = os.path.join(os.getcwd(), "logs") if os.path.exists(logs_dir): log_files = [f for f in os.listdir(logs_dir) if f.startswith("SCALPER_HEDGER_")] print(f"Found log files: {log_files}") if log_files: latest_log = sorted(log_files)[-1] log_file_path = os.path.join(logs_dir, latest_log) # Show log file content with open(log_file_path, 'r') as f: content = f.read() print(f"\n=== LOG FILE CONTENT ({latest_log}) ===") print(content) else: print("❌ No SCALPER_HEDGER log files found") else: print("❌ No logs directory found") except Exception as e: print(f"❌ Error: {e}") import traceback traceback.print_exc()