mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 06:22:44 -08:00
pretty
This commit is contained in:
@@ -17,15 +17,18 @@ ordinal: 20000
|
||||
## Description
|
||||
|
||||
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||
|
||||
Replace ad-hoc console.log/console.error calls throughout the codebase with a lightweight structured logger that supports configurable verbosity levels (debug, info, warn, error).
|
||||
|
||||
## Motivation
|
||||
|
||||
- TASK-33 (restrict mpv socket logs) is a symptom of a broader problem: no log-level filtering
|
||||
- Debugging production issues requires grepping through noisy output
|
||||
- Users report log spam in normal operation
|
||||
- No way to enable verbose logging for bug reports without code changes
|
||||
|
||||
## Scope
|
||||
|
||||
1. Create a minimal logger module (no external dependencies needed) with `debug`, `info`, `warn`, `error` levels
|
||||
2. Add a config option for log verbosity (default: `info`)
|
||||
3. Add a CLI flag to control logging verbosity (`--log-level`) while keeping `--debug` as app/dev mode.
|
||||
@@ -33,6 +36,7 @@ Replace ad-hoc console.log/console.error calls throughout the codebase with a li
|
||||
5. Include context tags (service name, operation) in log output for filterability
|
||||
|
||||
## Design constraints
|
||||
|
||||
- Zero external dependencies — use a simple wrapper over console methods
|
||||
- Must not impact hot-path performance (subtitle rendering, tokenization)
|
||||
- Log level should be changeable at runtime via config hot-reload if that feature exists
|
||||
@@ -40,7 +44,9 @@ Replace ad-hoc console.log/console.error calls throughout the codebase with a li
|
||||
<!-- SECTION:DESCRIPTION:END -->
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
<!-- AC:BEGIN -->
|
||||
|
||||
- [x] #1 A logger module exists with debug/info/warn/error levels.
|
||||
- [x] #2 Config option controls default verbosity level.
|
||||
- [x] #3 CLI `--log-level` override config.
|
||||
@@ -53,17 +59,19 @@ Replace ad-hoc console.log/console.error calls throughout the codebase with a li
|
||||
## Implementation Plan
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1) Audit remaining runtime console calls and classify by target (core runtime vs help/UI/test-only).
|
||||
2) Keep `--debug` scoped to Electron app/dev mode only; `--log-level` controls logging verbosity.
|
||||
3) Add tests for parsing and startup to keep logging override behavior stable.
|
||||
4) Migrate remaining non-user-facing `console.*` calls in core paths (especially tokenization, jimaku, config generation, electron-backend/notifications) to logger and include context via child loggers.
|
||||
5) Ensure mpv-related connection/reconnect messages use debug level; keep user-facing success/failure outputs when intended.
|
||||
6) Run focused test updates for impacted files, update task notes/acceptance criteria, and finalize task state.
|
||||
|
||||
1. Audit remaining runtime console calls and classify by target (core runtime vs help/UI/test-only).
|
||||
2. Keep `--debug` scoped to Electron app/dev mode only; `--log-level` controls logging verbosity.
|
||||
3. Add tests for parsing and startup to keep logging override behavior stable.
|
||||
4. Migrate remaining non-user-facing `console.*` calls in core paths (especially tokenization, jimaku, config generation, electron-backend/notifications) to logger and include context via child loggers.
|
||||
5. Ensure mpv-related connection/reconnect messages use debug level; keep user-facing success/failure outputs when intended.
|
||||
6. Run focused test updates for impacted files, update task notes/acceptance criteria, and finalize task state.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
<!-- SECTION:NOTES:BEGIN -->
|
||||
|
||||
Updated logging override semantics so `--debug` stays an app/dev-only flag and `--log-level` is the CLI logging control.
|
||||
|
||||
Migrated remaining non-user-facing runtime `console.*` calls in core paths (`notification`, `config-gen`, `electron-backend`, `jimaku`, `tokenizer`) to structured logger
|
||||
@@ -75,12 +83,15 @@ Updated help text and CLI parsing/tests for logging via `--log-level` while keep
|
||||
Validated with focused test run: `node --test dist/cli/args.test.js dist/core/services/startup-bootstrap-service.test.js dist/core/services/cli-command-service.test.js`
|
||||
|
||||
Build still passes via `pnpm run build`
|
||||
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
## Final Summary
|
||||
|
||||
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
|
||||
|
||||
TASK-36 is now complete; structured logging is consistently used in core runtime paths, with CLI log verbosity controlled by `--log-level`, while `--debug` remains an Electron app/dev-mode toggle.
|
||||
|
||||
Backlog task moved to Done after verification of build and focused tests.
|
||||
|
||||
<!-- SECTION:FINAL_SUMMARY:END -->
|
||||
|
||||
Reference in New Issue
Block a user