#!/usr/bin/env python3 """ Test script to verify logging configuration works correctly """ import os import sys # Add current directory to Python path current_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(current_dir) from logging_utils import setup_logging def test_logging(): """Test logging functionality""" # Setup logging setup_logging("normal", "TEST") import logging # Test different log levels logging.debug("This is a DEBUG message - should appear in file only") logging.info("This is an INFO message - should appear in both console and file") logging.warning("This is a WARNING message - should appear in both console and file") logging.error("This is an ERROR message - should appear in both console and file") # Check if log file was created logs_dir = os.path.join(os.getcwd(), "logs") log_files = [f for f in os.listdir(logs_dir) if f.startswith("TEST_")] if log_files: print(f"\nāœ… Log file created successfully: {log_files[0]}") print(f"šŸ“ Log directory: {logs_dir}") # Show log file content 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 file content:\n{content}") else: print("āŒ No log file created!") print("\nšŸ” Check logs directory for detailed log files") if __name__ == "__main__": test_logging()