feat: Implement comprehensive non-hierarchical logging system
- Created new logging infrastructure with per-component filtering - Added 6 log levels: DEBUG, INFO, API, WARNING, ERROR, CRITICAL - Implemented non-hierarchical level control (any combination can be enabled) - Migrated 917 print() statements across 31 files to structured logging - Created web UI (system.html) for runtime configuration with dark theme - Added global level controls to enable/disable levels across all components - Added timestamp format control (off/time/date/datetime options) - Implemented log rotation (10MB per file, 5 backups) - Added API endpoints for dynamic log configuration - Configured HTTP request logging with filtering via api.requests component - Intercepted APScheduler logs with proper formatting - Fixed persistence paths to use /app/memory for Docker volume compatibility - Fixed checkbox display bug in web UI (enabled_levels now properly shown) - Changed System Settings button to open in same tab instead of new window Components: bot, api, api.requests, autonomous, persona, vision, llm, conversation, mood, dm, scheduled, gpu, media, server, commands, sentiment, core, apscheduler All settings persist across container restarts via JSON config.
This commit is contained in:
@@ -4,17 +4,20 @@ import asyncio
|
||||
import globals
|
||||
from utils.moods import load_mood_description
|
||||
from utils.scheduled import send_bedtime_reminder
|
||||
from utils.logger import get_logger
|
||||
|
||||
logger = get_logger('commands')
|
||||
|
||||
|
||||
def set_mood(new_mood: str) -> bool:
|
||||
"""Set mood (legacy function - now handled per-server or DM)"""
|
||||
print("⚠️ set_mood called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
logger.warning("set_mood called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
return False
|
||||
|
||||
|
||||
def reset_mood() -> str:
|
||||
"""Reset mood to neutral (legacy function - now handled per-server or DM)"""
|
||||
print("⚠️ reset_mood called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
logger.warning("reset_mood called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
return "neutral"
|
||||
|
||||
|
||||
@@ -24,7 +27,7 @@ def check_mood():
|
||||
|
||||
def calm_miku() -> str:
|
||||
"""Calm Miku down (legacy function - now handled per-server or DM)"""
|
||||
print("⚠️ calm_miku called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
logger.warning("calm_miku called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
return "neutral"
|
||||
|
||||
|
||||
@@ -34,14 +37,14 @@ def reset_conversation(user_id):
|
||||
|
||||
async def force_sleep() -> str:
|
||||
"""Force Miku to sleep (legacy function - now handled per-server or DM)"""
|
||||
print("⚠️ force_sleep called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
logger.warning("force_sleep called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
return "asleep"
|
||||
|
||||
|
||||
async def wake_up(set_sleep_state=None):
|
||||
reset_mood()
|
||||
# Note: DMs don't have sleep states, so this is deprecated
|
||||
print("⚠️ wake_up called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
logger.warning("wake_up called - this function is deprecated. Use server-specific mood endpoints instead.")
|
||||
|
||||
if set_sleep_state:
|
||||
await set_sleep_state(False)
|
||||
@@ -59,5 +62,5 @@ async def update_profile_picture(mood: str = "neutral"):
|
||||
success = await update_profile_picture(globals.client, mood=mood)
|
||||
return success
|
||||
except Exception as e:
|
||||
print(f"⚠️ Error updating profile picture: {e}")
|
||||
logger.error(f"Error updating profile picture: {e}")
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user