Skip to content

feat: console 日志时间戳增加日期(YYYY-MM-DD) - #9617

Open
x1051445024 wants to merge 1 commit into
AstrBotDevs:masterfrom
x1051445024:feat/log-console-date
Open

feat: console 日志时间戳增加日期(YYYY-MM-DD)#9617
x1051445024 wants to merge 1 commit into
AstrBotDevs:masterfrom
x1051445024:feat/log-console-date

Conversation

@x1051445024

@x1051445024 x1051445024 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

问题

backend.log(桌面端捕获的后端 console 输出)时间戳只有时分秒(HH:mm:ss.SSS),没有日期。日志文件跨多天轮转后,无法区分事件发生在哪天,排查问题时极易混淆(例如 7-24 的 [11:19:19.110] 与 8-10 的 [11:19:19.534] 仅差毫秒级,实际相隔 17 天)。

修改

仅改 log.py 第 232 行 console sink 的 format:{time:HH:mm:ss.SSS}{time:YYYY-MM-DD HH:mm:ss.SSS}。file sink(astrbot.log)本身已有日期,不做改动。

效果

console 输出(WebUI 控制台 / 桌面端 backend.log)每条日志自带日期,不再跨天混淆。

影响面

仅日志展示格式,无任何功能逻辑变更。

Summary by Sourcery

Enhancements:

  • Update console logging format to include full date (YYYY-MM-DD) alongside time in timestamps for Web UI and desktop backend logs.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. area:core The bug / feature is about astrbot's core, backend labels Aug 10, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


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 lgtm This PR has been approved by a maintainer label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants