Skip to content

Conversation

@KBVsent
Copy link
Contributor

@KBVsent KBVsent commented Jan 24, 2026

Related issue: #4616
Add a configurable option to disable Dashboard API access logs. Currently, all API requests (frontend polling, health checks, etc.) generate INFO-level logs that clutter console output and obscure important business logs.

Modifications / 改动点

Files Changed:

  • astrbot/core/config/default.py: Added dashboard.disable_access_log config (default: True)
  • astrbot/dashboard/server.py: Modified run() to conditionally disable Hypercorn access log
  • dashboard/src/i18n/locales/*/config-metadata.json: Added translations (zh-CN, en-US)

Implementation:

  • When disabled: Sets HyperConfig.accesslog = None
  • Configurable via WebUI system settings
  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果


Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Summary by Sourcery

添加一个可配置选项,用于切换 Dashboard API 访问日志,并通过后端默认配置和 WebUI 配置元数据进行串联。

新功能:

  • 引入 dashboard.disable_access_log 配置标志,用于控制 Dashboard API 访问日志,默认禁用。
  • 在 WebUI 配置元数据中暴露访问日志开关,并提供本地化描述。

改进:

  • 更新 dashboard 服务器的启动逻辑,根据新的 dashboard.disable_access_log 设置配置 Hypercorn 的访问日志。
Original summary in English

Summary by Sourcery

Add a configurable option to toggle Dashboard API access logging and wire it through backend defaults and WebUI configuration metadata.

New Features:

  • Introduce a dashboard.disable_access_log configuration flag to control Dashboard API access logging, defaulting to disabled.
  • Expose the access log toggle in the WebUI configuration metadata with localized descriptions.

Enhancements:

  • Update the dashboard server startup to configure Hypercorn access logging based on the new dashboard.disable_access_log setting.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 24, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给了一些高层次的反馈:

  • disable_access_log 的默认值同时在 default.py 中被硬编码了一次,又在 server.py 里的 .get(..., True) 调用中被硬编码了一次;建议只依赖配置文件中的默认值,这样即使其中一个发生变化,行为也不会在不知不觉中出现偏差。
  • run() 中 Hypercorn 的配置逻辑开始变得有些臃肿;你可以考虑把与 access log 相关的配置提取到一个小的辅助函数里(例如 _configure_access_log(config)),这样可以让 run() 更专注于整体编排,而不是各种连接细节。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- The `disable_access_log` default is hardcoded both in `default.py` and again in the `.get(..., True)` call in `server.py`; consider relying on the config default only so the behavior doesn’t silently diverge if one of them changes.
- The Hypercorn configuration setup in `run()` is starting to grow; you might want to extract the access-log related config into a small helper (e.g., `_configure_access_log(config)`) to keep `run()` focused on orchestration rather than wiring details.

Sourcery 对开源项目是免费的——如果你觉得这次 Review 有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进之后的 Review。
Original comment in English

Hey - I've left some high level feedback:

  • The disable_access_log default is hardcoded both in default.py and again in the .get(..., True) call in server.py; consider relying on the config default only so the behavior doesn’t silently diverge if one of them changes.
  • The Hypercorn configuration setup in run() is starting to grow; you might want to extract the access-log related config into a small helper (e.g., _configure_access_log(config)) to keep run() focused on orchestration rather than wiring details.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `disable_access_log` default is hardcoded both in `default.py` and again in the `.get(..., True)` call in `server.py`; consider relying on the config default only so the behavior doesn’t silently diverge if one of them changes.
- The Hypercorn configuration setup in `run()` is starting to grow; you might want to extract the access-log related config into a small helper (e.g., `_configure_access_log(config)`) to keep `run()` focused on orchestration rather than wiring details.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot bot added the area:webui The bug / feature is about webui(dashboard) of astrbot. label Jan 24, 2026
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jan 24, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 24, 2026
@Soulter Soulter merged commit 4839cc6 into AstrBotDevs:master Jan 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants