hit-cxf
2026-05-15 d21bb89eebc9fadfa10ce290d836e586197a9e22
可选关闭后端的http日志输出,防止轮询刷屏
6 files modified
19 ■■■■■ changed files
video-claw/video-claw/backend/api/logging_config.py 6 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/backend/api/routers/configuration.py 5 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/backend/api_server.py 2 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/backend/config.py 4 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/backend/config.yaml.example 1 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/frontend/app/settings/page.tsx 1 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/backend/api/logging_config.py
@@ -7,6 +7,11 @@
_listener = None
def apply_access_log_setting():
    """Apply the runtime access-log switch for uvicorn request logs."""
    logging.getLogger("uvicorn.access").disabled = not Config.ACCESS_LOG
class AIGCFormatter(logging.Formatter):
    """Custom log formatter that adds level icons for better readability."""
@@ -54,6 +59,7 @@
        logger.handlers.clear()
        logger.propagate = True
        logger.setLevel(logging.WARNING if name == "httpx" else level)
    apply_access_log_setting()
    _listener = listener
    return listener
video-claw/video-claw/backend/api/routers/configuration.py
@@ -3,6 +3,7 @@
from fastapi import APIRouter
from pydantic import BaseModel, Field
from api.logging_config import apply_access_log_setting
from config import Config, CONFIG_PATH
router = APIRouter(tags=["Configuration"])
@@ -22,7 +23,9 @@
@router.put("/api/config")
async def update_config(req: ConfigUpdateRequest):
    config = Config.update_config(req.values)
    apply_access_log_setting()
    return {
        "config": Config.update_config(req.values),
        "config": config,
        "path": str(CONFIG_PATH),
    }
video-claw/video-claw/backend/api_server.py
@@ -17,7 +17,7 @@
def main():
    uvicorn.run(app, host=settings.HOST, port=settings.PORT)
    uvicorn.run(app, host=settings.HOST, port=settings.PORT, access_log=settings.ACCESS_LOG)
if __name__ == "__main__":
video-claw/video-claw/backend/config.py
@@ -18,6 +18,7 @@
        "host": "127.0.0.1",
        "port": 8000,
        "debug": False,
        "access_log": False,
    },
    "api_providers": {
        "common": {
@@ -98,6 +99,7 @@
    except (TypeError, ValueError):
        server["port"] = DEFAULT_CONFIG["server"]["port"]
    server["debug"] = _as_bool(server.get("debug"))
    server["access_log"] = _as_bool(server.get("access_log"))
    server.pop("admin_password", None)
    common = clean["api_providers"]["common"]
@@ -166,6 +168,7 @@
    HOST = _get(CONFIG, "server.host")
    PORT = _get(CONFIG, "server.port")
    DEBUG = _get(CONFIG, "server.debug")
    ACCESS_LOG = _get(CONFIG, "server.access_log")
    PRINT_MODEL_INPUT = _get(CONFIG, "api_providers.common.print_model_input")
    PROXY = _get(CONFIG, "api_providers.common.proxy")
@@ -234,6 +237,7 @@
        cls.HOST = _get(clean, "server.host")
        cls.PORT = _get(clean, "server.port")
        cls.DEBUG = _get(clean, "server.debug")
        cls.ACCESS_LOG = _get(clean, "server.access_log")
        cls.PRINT_MODEL_INPUT = _get(clean, "api_providers.common.print_model_input")
        cls.PROXY = _get(clean, "api_providers.common.proxy")
video-claw/video-claw/backend/config.yaml.example
@@ -3,6 +3,7 @@
  host: 127.0.0.1
  port: 8000
  debug: false
  access_log: false
api_providers:
  common:
    print_model_input: false
video-claw/video-claw/frontend/app/settings/page.tsx
@@ -39,6 +39,7 @@
      { path: 'server.host', label: 'host' },
      { path: 'server.port', label: 'port', type: 'number' },
      { path: 'server.debug', label: 'debug', type: 'boolean' },
      { path: 'server.access_log', label: 'access_log', type: 'boolean' },
    ],
  },
  {