#!/usr/bin/env python3 """ Test script to verify hedger logging works """ 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 setup_logging function from logging_utils import setup_logging # Test the same logging setup as hedger setup_logging("normal", "SCALPER_HEDGER") import logging # Test the exact logging pattern used in hedger logging.info(f"šŸ”· Delta-Zero Scalper Hedger initialized. Agent: 0x1234567890123456789012345678901234567890") logging.info(f"šŸ›”ļø Capital Safety: Price Buffer {0.25*100:.1f}% | Min Threshold {0.012} ETH (~${0.012*3000:.0f} USD)") logging.info(f"⚔ Dynamic Protection: Volatility Multiplier {1.5}x | Trade Cooldown {30}s | Max Hedge {1.2*100:.0f}%") # Test HIGH VELOCITY logging (the original problem) test_velocity = 0.05 # 5% velocity logging.info(f"āš ļø COOLDOWN BYPASSED: HIGH VELOCITY ({test_velocity*100:.2f}%/interval, $+50.00)") print("\n=== LOGGING TEST COMPLETED ===") print("Check logs/SCALPER_HEDGER_20251217.log for output") # Show current log files 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"\nFound hedger log files: {log_files}") # Show content if file exists if log_files: log_file_path = os.path.join(logs_dir, log_files[0]) with open(log_file_path, 'r') as f: content = f.read() print(f"\nšŸ“„ Log content:\n{content}") except ImportError as e: print(f"āŒ Import Error: {e}") print("Make sure logging_utils.py is in the same directory") except Exception as e: print(f"āŒ Error: {e}") import traceback traceback.print_exc()