Skip to content

fix(knowledge): emit local-time ISO 8601 timestamps from logger - #1272

Open
dvd233 wants to merge 1 commit into
TencentCloud:feat/server_teamfrom
dvd233:fix/knowledge-logger-timezone
Open

dvd233 wants to merge 1 commit into
TencentCloud:feat/server_teamfrom
dvd233:fix/knowledge-logger-timezone

Conversation

@dvd233

@dvd233 dvd233 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Description | 描述

Addresses the first item of #1264 (Knowledge logger timezone).

MemoryKnowledge/src/logger.ts produced UTC timestamps via toISOString() with no timezone marker (2026-09-05 08:16:21.677), while MemoryCore's gateway logger uses local time with an explicit offset (nowLocalIso, 2026-09-05T16:16:21.677+08:00). Correlating an incident across the two services required mental offset conversion with no in-band hint.

Timezone-configurable output was already accepted for the core service in #75 / #87 via #129, but that change predates the MemoryKnowledge module — its 15 changed files contain nothing under MemoryKnowledge/, and logger.ts still used toISOString() on HEAD.

Change: ts() now uses the same local-time ISO 8601 format as MemoryCore (dayjs().format("YYYY-MM-DDTHH:mm:ss.SSSZ")), which stays ISO 8601 compliant and round-trippable while matching what an operator sees in tmux / tail -f. dayjs is already a MemoryKnowledge dependency.

Scope note: this PR intentionally covers only the timezone item. The other two observations in #1264 (the LOG_PATH default deactivating file rotation off-container, and the console logger having no level filter) involve deployment-shape and configuration-surface decisions and are left for a separate change.

Related Issue | 关联 Issue

Addresses #1264 (item 1)

Change Type | 修改类型

  • Bug fix | Bug 修复

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能

Additional Notes | 其他说明

  • New src/logger.test.ts asserts the emitted line matches local-time ISO 8601 with an explicit offset; it fails against the old bare-UTC format and passes after the change.
  • npm run build (tsdown) passes.
  • MemoryKnowledge 依赖安装在本机用 --ignore-scripts(无 Visual Studio C++ workload,原生模块跳过);logger 路径不依赖原生模块。

This PR was prepared with AI coding assistance; the verification (fact-checking #129's file list, red→green test, build) was run locally by me. 本 PR 在 AI 编码助手辅助下完成,核验与验证均由本人本地执行。

The Knowledge logger produced UTC via toISOString() with no timezone
marker, while MemoryCore's gateway logger uses local time with an
explicit offset (nowLocalIso, gateway/server.ts). Cross-service incident
correlation required mental offset conversion with no in-band hint.

Timezone configurability was already accepted for the core service in
TencentCloud#75/TencentCloud#87 via TencentCloud#129, but that change predates the MemoryKnowledge module —
its 15 files contain nothing under MemoryKnowledge/. Align the Knowledge
logger with the same local-time ISO 8601 format.

Addresses the first item of TencentCloud#1264

@yangjj-iso yangjj-iso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

未发现生产代码层面的阻塞性问题,logger.ts 的实现与 MemoryCore 的既有格式一致,且 dayjs 已是运行时依赖。

@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

done

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants