""" Runtime Logging Control Utility Allows enabling/disabling logging channels at runtime without restarting the application. """ import sys from pathlib import Path # Add parent directory to path parent_dir = Path(__file__).parent.parent sys.path.insert(0, str(parent_dir)) from utils.logging_config import ( enable_channel, disable_channel, get_enabled_channels, print_channel_status, LogChannel ) def main(): """Interactive logging control""" print("\n" + "="*50) print(" Logging Channel Control") print("="*50) while True: print("\nCommands:") print(" status - Show current channel status") print(" enable - Enable a channel") print(" disable - Disable a channel") print(" list - List all available channels") print(" quit - Exit") cmd = input("\n> ").strip().lower() if cmd == 'quit' or cmd == 'exit' or cmd == 'q': break elif cmd == 'status': print_channel_status() elif cmd == 'list': print("\nAvailable Channels:") print(f" - {LogChannel.CORE} (Core system operations)") print(f" - {LogChannel.TRADING} (Trading operations)") print(f" - {LogChannel.TRAINING} (Model training)") print(f" - {LogChannel.INFERENCE} (Model inference)") print(f" - {LogChannel.PIVOTS} (Pivot calculations)") print(f" - {LogChannel.DATA} (Data fetching/caching)") print(f" - {LogChannel.WEBSOCKET} (WebSocket communications)") print(f" - {LogChannel.API} (API requests/responses)") print(f" - {LogChannel.WEBUI} (Web UI chart requests)") print(f" - {LogChannel.PERFORMANCE} (Performance metrics)") print(f" - {LogChannel.DEBUG} (Debug information)") elif cmd == 'enable': channel = input("Channel name: ").strip() enable_channel(channel) elif cmd == 'disable': channel = input("Channel name: ").strip() disable_channel(channel) else: print("Unknown command. Type 'quit' to exit.") if __name__ == '__main__': main()