mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
Cleaner Logs (#12579)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -11,6 +11,7 @@ import os
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
import warnings
|
||||
from datetime import datetime
|
||||
from logging.handlers import TimedRotatingFileHandler
|
||||
from types import TracebackType
|
||||
@@ -20,6 +21,17 @@ import litellm
|
||||
from pythonjsonlogger.json import JsonFormatter
|
||||
from termcolor import colored
|
||||
|
||||
# Suppress deprecation warnings from dependencies before they're imported
|
||||
# aifc was removed in Python 3.13 but speech_recognition still references it
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter('ignore')
|
||||
import aifc
|
||||
|
||||
# Stop the linter from deleting the import
|
||||
_AIFC = aifc.__name__
|
||||
|
||||
warnings.filterwarnings('ignore', category=SyntaxWarning, module=r'pydub\.utils')
|
||||
|
||||
LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO').upper()
|
||||
DEBUG = os.getenv('DEBUG', 'False').lower() in ['true', '1', 'yes']
|
||||
DEBUG_LLM = os.getenv('DEBUG_LLM', 'False').lower() in ['true', '1', 'yes']
|
||||
@@ -419,6 +431,7 @@ LOQUACIOUS_LOGGERS = [
|
||||
'socketio.client',
|
||||
'socketio.server',
|
||||
'aiosqlite',
|
||||
'alembic.runtime.plugins.setup',
|
||||
]
|
||||
|
||||
for logger_name in LOQUACIOUS_LOGGERS:
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
# Tag: Legacy-V0
|
||||
# This module belongs to the old V0 web server. The V1 application server lives under openhands/app_server/.
|
||||
import os
|
||||
import warnings
|
||||
|
||||
import uvicorn
|
||||
|
||||
@@ -15,9 +14,6 @@ from openhands.core.logger import get_uvicorn_json_log_config
|
||||
|
||||
|
||||
def main():
|
||||
# Suppress SyntaxWarnings from pydub.utils about invalid escape sequences
|
||||
warnings.filterwarnings('ignore', category=SyntaxWarning, module=r'pydub\.utils')
|
||||
|
||||
# When LOG_JSON=1, configure Uvicorn to emit JSON logs for error/access
|
||||
log_config = None
|
||||
if os.getenv('LOG_JSON', '0') in ('1', 'true', 'True'):
|
||||
|
||||
Reference in New Issue
Block a user