mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
- Implemented ConvertConfirmScreen for confirming AVI to MKV conversions with audio and subtitle options. - Added DeleteConfirmScreen for confirming file deletions with detailed file information. - Enhanced MediaPanelView to include additional MediaInfo properties such as video, audio, and subtitle tracks. - Updated MediaPanelProperties to extract and display raw MediaInfo track data. - Introduced HelpScreen for user guidance on application features and navigation. - Created OpenScreen for directory path input with validation. - Developed RenameConfirmScreen for renaming files with user confirmation and editing capabilities. - Added SettingsScreen for configuring application settings, including cache TTL and HEVC encoding options. - Updated imports and module exports in views to accommodate new screens.
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
"""Singleton logging configuration for the renamer application.
|
|
|
|
This module provides centralized logging configuration that is initialized
|
|
once and used throughout the application.
|
|
"""
|
|
|
|
import logging
|
|
import os
|
|
import threading
|
|
|
|
|
|
class LoggerConfig:
|
|
"""Singleton logger configuration."""
|
|
|
|
_instance = None
|
|
_lock = threading.Lock()
|
|
_initialized = False
|
|
|
|
def __new__(cls):
|
|
"""Create or return singleton instance."""
|
|
if cls._instance is None:
|
|
with cls._lock:
|
|
if cls._instance is None:
|
|
cls._instance = super().__new__(cls)
|
|
return cls._instance
|
|
|
|
def __init__(self):
|
|
"""Initialize logging configuration (only once)."""
|
|
if LoggerConfig._initialized:
|
|
return
|
|
|
|
# Check environment variable for formatter logging
|
|
if os.getenv('FORMATTER_LOG', '0') == '1':
|
|
logging.basicConfig(
|
|
filename='formatter.log',
|
|
level=logging.DEBUG,
|
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
)
|
|
# When FORMATTER_LOG is not '1', do not configure logging at all
|
|
|
|
LoggerConfig._initialized = True
|
|
|
|
|
|
# Initialize logging on import
|
|
LoggerConfig()
|