Skip to content

fix: replace console.* and silent .catch(() => {}) with structured logging in TUI#791

Open
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-structured-logging
Open

fix: replace console.* and silent .catch(() => {}) with structured logging in TUI#791
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-structured-logging

Conversation

@MrRealORG

Copy link
Copy Markdown

Summary

Replace console.error/console.log calls with Log.create().error/debug in TUI components for consistent structured logging. Replace silent .catch(() => {}) with proper error logging.

Changes

File Change
app.tsx 2x console.errorlog.error
dialog-mcp.tsx 2x console.errorlog.error
plugin/slots.tsx console.errorlog.error
context/kv.tsx 3x console.errorlog.error
prompt/index.tsx console.loglog.error
util/clipboard.ts 6x console.loglog.debug
thread.ts silent .catch(() => {})log.error
dialog-worktree.tsx silent .catch(() => {})log.error
dialog-image-list.tsx silent .catch(() => {})log.error

Motivation

  • Consistent logging: All TUI components now use the structured Log.create() utility instead of raw console.*, making logs searchable and filterable by service name.
  • Error visibility: Previously silent .catch(() => {}) patterns in worktree switching, background image directory creation, and upgrade checking now properly log errors for debugging.
  • Clipboard debugging: console.log("clipboard: using X") calls are replaced with log.debug() which respects log level configuration.

Testing

Verified no remaining console.log/error in the 9 changed files. All Log.create() calls follow the existing pattern used elsewhere in the codebase (e.g., config/tui.ts, plugin/runtime.ts).

…gging in TUI

Replace console.error/console.log calls with Log.create().error/debug
in TUI components for consistent structured logging. Replace silent
.catch(() => {}) with proper error logging in thread.ts (upgrade check),
dialog-worktree.tsx (instance dispose), and dialog-image-list.tsx
(backgrounds directory creation).

Files changed:
- app.tsx: 2x console.error -> log.error
- dialog-mcp.tsx: 2x console.error -> log.error
- plugin/slots.tsx: console.error -> log.error
- context/kv.tsx: 3x console.error -> log.error
- prompt/index.tsx: console.log -> log.error
- util/clipboard.ts: 6x console.log -> log.debug
- thread.ts: silent .catch -> log.error
- dialog-worktree.tsx: silent .catch -> log.error
- dialog-image-list.tsx: silent .catch -> log.error
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.

1 participant