Cleaner Logs (#12579)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Tim O'Farrell
2026-01-30 08:25:36 -07:00
committed by GitHub
parent 0b8c69fad2
commit e62ceafa4a
3 changed files with 21 additions and 8 deletions

View File

@@ -1,4 +1,6 @@
from pydantic import BaseModel, EmailStr, Field
from typing import Annotated
from pydantic import BaseModel, EmailStr, Field, StringConstraints
from storage.org import Org
@@ -53,9 +55,11 @@ class OrgCreate(BaseModel):
"""Request model for creating a new organization."""
# Required fields
name: str = Field(min_length=1, max_length=255, strip_whitespace=True)
name: Annotated[
str, StringConstraints(strip_whitespace=True, min_length=1, max_length=255)
]
contact_name: str
contact_email: EmailStr = Field(strip_whitespace=True)
contact_email: EmailStr
class OrgResponse(BaseModel):
@@ -145,7 +149,7 @@ class OrgUpdate(BaseModel):
# Basic organization information (any authenticated user can update)
contact_name: str | None = None
contact_email: EmailStr | None = Field(default=None, strip_whitespace=True)
contact_email: EmailStr | None = None
conversation_expiration: int | None = None
default_max_iterations: int | None = Field(default=None, gt=0)
remote_runtime_resource_factor: int | None = Field(default=None, gt=0)

View File

@@ -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:

View File

@@ -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'):