Files
uj-mastering-master/demo_logging.py
T
Mikkeli Matlock 4337a31b80 Implement threading, logging, and CJK font support
Major improvements to GUI stability and internationalization:

- Fix GUI freezing by implementing threaded audio analysis
  - Add AudioAnalysisWorker thread for background processing
  - Progress signals with percentage updates
  - Thread-safe communication via Qt signals

- Add comprehensive CLI logging system
  - 5 log levels: ERROR, WARN, INFO, DEBUG, TRACE
  - Command line control: --log-level, --log-file
  - Real-time feedback during analysis operations

- Implement CJK font fallback system
  - FontManager with 3-tier fallback (custom → system → default)
  - Cross-platform CJK font detection (Windows/macOS/Linux)
  - Licensing-safe fonts/ directory with gitignored font files
  - Setup utility and comprehensive documentation

- Fix numpy array formatting issue with BPM detection
- Add progress indicators for long-running operations
- Preserve fonts directory structure with placeholder file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 23:39:53 +09:00

40 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Demo script showing the different logging levels available.
Usage examples:
python demo_logging.py --log-level=ERROR
python demo_logging.py --log-level=INFO
python demo_logging.py --log-level=DEBUG
python demo_logging.py --log-level=TRACE --log-file
"""
import sys
from logger_setup import setup_logging, parse_log_args
def main():
# Parse logging configuration
log_level, log_to_file = parse_log_args()
# Initialize logging
logger = setup_logging(log_level, log_to_file)
# Demo different log levels
print(f"\n=== Audio Mastering Toolkit Logging Demo ===")
print(f"Log Level: {log_level}")
print(f"Log to File: {log_to_file}")
print(f"============================================\n")
# Test all logging levels
logger.error("This is an ERROR message - critical failures only")
logger.warning("This is a WARNING message - non-fatal issues")
logger.info("This is an INFO message - key operations")
logger.debug("This is a DEBUG message - detailed processing steps")
logger.trace("This is a TRACE message - granular details")
print(f"\nDemo complete! Messages above {log_level} level are visible.")
if log_to_file:
print("Check 'audio_analysis.log' for file output.")
if __name__ == '__main__':
main()