Skip to content

Refactor logging/debugging approach across codebase - #733

Merged
malibio merged 6 commits into
mainfrom
feature/issue-363-logging-refactor
Dec 4, 2025
Merged

malibio merged 6 commits into
mainfrom
feature/issue-363-logging-refactor

Conversation

@malibio

@malibio malibio commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator

Closes #363

malibio and others added 2 commits December 4, 2025 16:23
## Completed in This Session
- [x] Enhanced Logger utility with environment-aware defaults
  - Production: warn level (clean console)
  - Development: debug level (all logs)
  - Tests: disabled (better performance)
  - Added group(), groupEnd(), time() methods
- [x] Migrated key frontend services to Logger
  - browser-sync-service.ts (16 statements)
  - app-initialization.ts (5 statements)
  - navigation-service.ts (5 statements)
- [x] Migrated schema-plugin-loader.ts (6 statements)
- [x] Updated test expecting console.error (now uses logger)

## Remaining Work
- [ ] Migrate remaining services (shared-node-store, reactive-node-service, etc.)
- [ ] Migrate frontend components (~35 statements)
- [ ] Migrate node type files (~17 statements)
- [ ] Migrate remaining plugins (~3 statements)
- [ ] Standardize Rust backend tracing

## Current State
- Files modified: 7 (logger.ts, 4 services, 1 plugin, 1 test)
- Tests status: All 1569 passing
- Quality checks: Passing (eslint, svelte-check, clippy)
- Remaining console statements in lib: ~204 (down from 328+)

## Context for Next Session
The Logger utility is fully enhanced and working. Key services that were
causing production console noise are migrated. The remaining work is
methodical migration of:
1. Services with internal log() helpers (layout-persistence, tab-persistence, etc.)
2. Console.error/warn calls (appropriate levels, just need Logger consistency)
3. Components and node type files
4. Rust backend println!/eprintln! → tracing

## Acceptance Criteria Status
From issue #363:
- [x] Logger utility enhanced with environment-aware defaults
- [x] Production console clean for migrated services
- [ ] All frontend services use Logger
- [ ] All frontend components use Logger
- [ ] All frontend plugins use Logger
- [ ] Backend library code uses tracing consistently

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
## Changes
- Migrate 40+ files from console.* to Logger utility
- Remove unused performance-monitor.ts (dead code)
- Update tests to verify behavior instead of log output
  (Logger is intentionally silenced during tests)

## Files Modified
### Services (core migration)
- layout-persistence-service.ts
- tab-persistence-service.ts
- node-expansion-coordinator.ts
- optimistic-operation-manager.svelte.ts
- backend-adapter.ts
- cursor-positioning-service.ts
- keyboard-command-registry.ts
- tauri-sync-listener.ts
- shared-node-store.svelte.ts
- reactive-node-service.svelte.ts
- content-processor.ts
- performance-tracker.ts

### Components
- base-node.svelte, base-node-viewer.svelte
- app-shell.svelte, tab-system.svelte, pane-content.svelte
- backlinks-panel.svelte, custom-entity-node.svelte
- schema-property-form.svelte, task-schema-form.svelte
- autocomplete-modal.svelte, node-service-context.svelte
- cursor-positioning.ts

### Plugins & Utils
- plugin-registry.ts, core-plugins.ts
- database-write-queue.ts, marked-config.ts
- navigation.ts, layout.ts, reactive-structure-tree.svelte.ts

### Tests Updated
- core-plugins.test.ts, plugin-registry.test.ts
- keyboard-command-registry.test.ts, mcp-integration.test.ts
- shared-node-store.test.ts, database-write-queue.test.ts

## Remaining Console Statements (Intentional)
- logger.ts: The Logger utility itself
- developer-inspector.ts: Developer debugging tools
- JSDoc examples in documentation

Closes #363

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator Author

Code Review: PR #733 - Logging Refactor

Review Type: Initial Review
Reviewer: AI Principal Engineer
Date: 2024-12-04


Requirements Check (Issue #363)

Criterion Status Notes
All frontend services use Logger ✅ 17 services migrated to Logger utility
All frontend components use Logger ✅ 9 components migrated to Logger utility
All frontend plugins use Logger ✅ 3 plugin files migrated to Logger utility
Logger utility enhanced ✅ Environment-aware defaults (production: warn, dev: debug)
Production console clean ✅ Production level set to 'warn' by default
Debug logs work via devtools ✅ Uses console.debug() which can be filtered in browser devtools
Backend library code uses tracing ✴️ Not in scope - backend has println!/eprintln! in bin files only (acceptable for CLI output)
Test files excluded ✅ Tests updated to verify behavior instead of log output

Code Review Findings

Suggested Improvements

[Improvement] Unused variable warning in logger.ts

File: packages/desktop-app/src/lib/utils/logger.ts:45-47

The _isDev variable is declared but never used. While the underscore prefix indicates intentional non-use, consider either:

  1. Removing it if not needed
  2. Adding a comment explaining why it's preserved for future use
const _isDev =
  (typeof import.meta !== 'undefined' && import.meta.env?.DEV === true) ||
  (typeof process !== 'undefined' && process.env?.NODE_ENV === 'development');

Rationale: YAGNI (You Aren't Gonna Need It) principle suggests removing unused code. However, this may be intentionally preserved for future conditional logic.


[Improvement] Minor inconsistency in log message formatting

Some migrated log calls include leading whitespace that was previously part of the prefix:

File: packages/desktop-app/src/lib/services/shared-node-store.svelte.ts:659

log.warn(` Cannot update non-existent node: ${nodeId}`);
//        ^ Leading space

This pattern appears in several places in shared-node-store.svelte.ts. The Logger already adds a prefix like [SharedNodeStore], so the leading space creates output like [SharedNodeStore] Cannot update... (double space).

Recommendation: Remove leading spaces from message strings for consistent output formatting.

Affected files:

  • shared-node-store.svelte.ts (multiple occurrences)

[Improvement] DeveloperInspector intentionally uses raw console.*

File: packages/desktop-app/src/lib/services/developer-inspector.ts:224-245

The developer-inspector.ts file intentionally uses raw console.* calls for its debugging output. This is acceptable since:

  1. Its purpose is to provide developer debugging tools in the browser console
  2. The fancy formatting with groups and emoji is intended for direct developer interaction

Note: This is correctly excluded from the migration and not a violation of the requirements.


[Improvement] Deleted PerformanceMonitor service

File: packages/desktop-app/src/lib/services/performance-monitor.ts (deleted)

The 525-line PerformanceMonitor service was deleted in this PR. Review the deletion rationale:

  1. The service was not imported or used anywhere in the codebase (confirmed by checking services/index.ts export removal)
  2. Its functionality (benchmarking, memory monitoring) was not being utilized
  3. Removal is consistent with the YAGNI principle

Assessment: This deletion is acceptable given the service was dead code.


Nitpicks

Nit: Documentation comments in types/ directory

The console.log references in packages/desktop-app/src/lib/types/*.ts files are within JSDoc comments showing usage examples, not actual code. These are acceptable and help developers understand the APIs.


Nit: Logger group methods lack nesting safety

File: packages/desktop-app/src/lib/utils/logger.ts:144-157

The group() and groupEnd() methods could potentially leave console groups open if group() is called but the corresponding code throws before groupEnd(). Consider documenting this caveat or providing a withGroup(label, fn) helper in the future.

// Current (potential issue on exception)
log.group('Operation');
await riskyOperation(); // If this throws, group is never closed
log.groupEnd();

// Alternative pattern (not required for this PR)
log.withGroup('Operation', async () => {
  await riskyOperation();
});

Test Updates Assessment

The test updates are well-designed. Instead of testing log output (implementation detail), tests now verify:

  1. Actual behavior - e.g., that non-existent nodes are not created
  2. Error handling - e.g., that operations don't throw for edge cases
  3. State consistency - e.g., that queue operations complete successfully

This approach makes tests more resilient to implementation changes and focuses on observable behavior.


Summary

Strengths:

  1. Comprehensive migration: 46 files updated with consistent Logger usage pattern
  2. Environment-aware defaults: Production gets clean console (warn/error only), development gets full debug output
  3. Well-documented utility: Logger has clear usage examples and environment behavior documentation
  4. Test resilience: Tests updated to verify behavior instead of log output (better practice)
  5. Clean architecture: Each service/component creates its own prefixed logger for traceability
  6. Performance consideration: Logger is disabled in tests to improve test execution speed
  7. Code cleanup: Removed unused PerformanceMonitor service (525 lines of dead code)

Areas for Improvement:

  1. Minor formatting inconsistency with leading spaces in some log messages (non-blocking)
  2. Unused _isDev variable in logger.ts (non-blocking)

Recommendation

APPROVE

The PR successfully achieves all acceptance criteria from Issue #363. The migration is comprehensive, consistent, and well-tested. The Logger utility is properly documented with environment-aware defaults that will keep production consoles clean while preserving debug capabilities for development.

The minor formatting inconsistencies noted are cosmetic and do not block the merge. They can be addressed in a follow-up cleanup if desired.

All 1569 tests pass. Quality checks (ESLint, svelte-check, Rust clippy) pass with no errors or warnings.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review Status: RECOMMEND APPROVAL

All acceptance criteria from Issue #363 are met:

  • Frontend services, components, and plugins migrated to Logger utility
  • Logger enhanced with environment-aware defaults (production: warn level, development: debug level)
  • Tests updated to verify behavior instead of log output (better practice)
  • 1569 tests pass, quality checks pass

Minor improvements suggested (non-blocking):

  • Remove leading spaces in some log messages (formatting)
  • Address unused _isDev variable in logger.ts

This is a solid infrastructure improvement that will keep production consoles clean while preserving debugging capabilities.

Note: Cannot formally approve own PR - requires another reviewer's approval.

- Remove unused _isDev variable in logger.ts (YAGNI principle)
- Remove leading spaces from log messages in shared-node-store.svelte.ts
  (18 occurrences fixed for consistent output formatting)

Addresses reviewer recommendations from PR #733 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator Author

Review Feedback Addressed

All reviewer recommendations have been addressed in commit 16ae98b.

Changes Made

Recommendation Status Change
Remove unused _isDev variable ✅ Addressed Removed from logger.ts
Remove leading spaces in log messages ✅ Addressed Fixed 18 occurrences in shared-node-store.svelte.ts

Verification

  • ✅ All 1569 tests pass
  • ✅ ESLint passes with no warnings
  • ✅ svelte-check passes with 0 errors
  • ✅ Rust clippy passes with no warnings

Summary

  • Addressed: 2 recommendations (all suggestions from review)
  • Skipped: 0 recommendations
  • Commits: 1

The PR is ready for merge.

malibio and others added 3 commits December 4, 2025 23:10
Added comprehensive logging section to code-quality.md:
- Zero console.log policy with exemptions for tests and DeveloperInspector
- Logger utility usage examples with createLogger()
- Log levels table with production visibility guidance
- Environment behavior (production vs development vs test)
- Logger features (timing, grouping)
- Migration guide from raw console.* calls

Addresses "Nice to Have" acceptance criterion from issue #363:
"Logging documentation added to development guide"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Added link to docs/architecture/development/standards/code-quality.md
- Added Logging Policy section with quick reference to Logger utility
- Ensures AI agents are aware of logging standards

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Resolved conflict in reactive-node-service.svelte.ts:
- Used new rollbackOutdentChanges helper from main
- Applied Logger (log.error) instead of console.error

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio
malibio merged commit b7404c9 into main Dec 4, 2025
@malibio
malibio deleted the feature/issue-363-logging-refactor branch December 4, 2025 22:14
malibio added a commit that referenced this pull request Feb 4, 2026
* WIP: Refactor logging to use Logger utility - Phase 1 complete

## Completed in This Session
- [x] Enhanced Logger utility with environment-aware defaults
  - Production: warn level (clean console)
  - Development: debug level (all logs)
  - Tests: disabled (better performance)
  - Added group(), groupEnd(), time() methods
- [x] Migrated key frontend services to Logger
  - browser-sync-service.ts (16 statements)
  - app-initialization.ts (5 statements)
  - navigation-service.ts (5 statements)
- [x] Migrated schema-plugin-loader.ts (6 statements)
- [x] Updated test expecting console.error (now uses logger)

## Remaining Work
- [ ] Migrate remaining services (shared-node-store, reactive-node-service, etc.)
- [ ] Migrate frontend components (~35 statements)
- [ ] Migrate node type files (~17 statements)
- [ ] Migrate remaining plugins (~3 statements)
- [ ] Standardize Rust backend tracing

## Current State
- Files modified: 7 (logger.ts, 4 services, 1 plugin, 1 test)
- Tests status: All 1569 passing
- Quality checks: Passing (eslint, svelte-check, clippy)
- Remaining console statements in lib: ~204 (down from 328+)

## Context for Next Session
The Logger utility is fully enhanced and working. Key services that were
causing production console noise are migrated. The remaining work is
methodical migration of:
1. Services with internal log() helpers (layout-persistence, tab-persistence, etc.)
2. Console.error/warn calls (appropriate levels, just need Logger consistency)
3. Components and node type files
4. Rust backend println!/eprintln! → tracing

## Acceptance Criteria Status
From issue #363:
- [x] Logger utility enhanced with environment-aware defaults
- [x] Production console clean for migrated services
- [ ] All frontend services use Logger
- [ ] All frontend components use Logger
- [ ] All frontend plugins use Logger
- [ ] Backend library code uses tracing consistently

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Complete logging refactor: Migrate all console.* to Logger utility

## Changes
- Migrate 40+ files from console.* to Logger utility
- Remove unused performance-monitor.ts (dead code)
- Update tests to verify behavior instead of log output
  (Logger is intentionally silenced during tests)

## Files Modified
### Services (core migration)
- layout-persistence-service.ts
- tab-persistence-service.ts
- node-expansion-coordinator.ts
- optimistic-operation-manager.svelte.ts
- backend-adapter.ts
- cursor-positioning-service.ts
- keyboard-command-registry.ts
- tauri-sync-listener.ts
- shared-node-store.svelte.ts
- reactive-node-service.svelte.ts
- content-processor.ts
- performance-tracker.ts

### Components
- base-node.svelte, base-node-viewer.svelte
- app-shell.svelte, tab-system.svelte, pane-content.svelte
- backlinks-panel.svelte, custom-entity-node.svelte
- schema-property-form.svelte, task-schema-form.svelte
- autocomplete-modal.svelte, node-service-context.svelte
- cursor-positioning.ts

### Plugins & Utils
- plugin-registry.ts, core-plugins.ts
- database-write-queue.ts, marked-config.ts
- navigation.ts, layout.ts, reactive-structure-tree.svelte.ts

### Tests Updated
- core-plugins.test.ts, plugin-registry.test.ts
- keyboard-command-registry.test.ts, mcp-integration.test.ts
- shared-node-store.test.ts, database-write-queue.test.ts

## Remaining Console Statements (Intentional)
- logger.ts: The Logger utility itself
- developer-inspector.ts: Developer debugging tools
- JSDoc examples in documentation

Closes #363

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Address review: Fix minor formatting issues in logging

- Remove unused _isDev variable in logger.ts (YAGNI principle)
- Remove leading spaces from log messages in shared-node-store.svelte.ts
  (18 occurrences fixed for consistent output formatting)

Addresses reviewer recommendations from PR #733 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add logging standards to code quality documentation

Added comprehensive logging section to code-quality.md:
- Zero console.log policy with exemptions for tests and DeveloperInspector
- Logger utility usage examples with createLogger()
- Log levels table with production visibility guidance
- Environment behavior (production vs development vs test)
- Logger features (timing, grouping)
- Migration guide from raw console.* calls

Addresses "Nice to Have" acceptance criterion from issue #363:
"Logging documentation added to development guide"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add logging policy and link to code quality standards in CLAUDE.md

- Added link to docs/architecture/development/standards/code-quality.md
- Added Logging Policy section with quick reference to Logger utility
- Ensures AI agents are aware of logging standards

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 5, 2026
* WIP: Refactor logging to use Logger utility - Phase 1 complete

## Completed in This Session
- [x] Enhanced Logger utility with environment-aware defaults
  - Production: warn level (clean console)
  - Development: debug level (all logs)
  - Tests: disabled (better performance)
  - Added group(), groupEnd(), time() methods
- [x] Migrated key frontend services to Logger
  - browser-sync-service.ts (16 statements)
  - app-initialization.ts (5 statements)
  - navigation-service.ts (5 statements)
- [x] Migrated schema-plugin-loader.ts (6 statements)
- [x] Updated test expecting console.error (now uses logger)

## Remaining Work
- [ ] Migrate remaining services (shared-node-store, reactive-node-service, etc.)
- [ ] Migrate frontend components (~35 statements)
- [ ] Migrate node type files (~17 statements)
- [ ] Migrate remaining plugins (~3 statements)
- [ ] Standardize Rust backend tracing

## Current State
- Files modified: 7 (logger.ts, 4 services, 1 plugin, 1 test)
- Tests status: All 1569 passing
- Quality checks: Passing (eslint, svelte-check, clippy)
- Remaining console statements in lib: ~204 (down from 328+)

## Context for Next Session
The Logger utility is fully enhanced and working. Key services that were
causing production console noise are migrated. The remaining work is
methodical migration of:
1. Services with internal log() helpers (layout-persistence, tab-persistence, etc.)
2. Console.error/warn calls (appropriate levels, just need Logger consistency)
3. Components and node type files
4. Rust backend println!/eprintln! → tracing

## Acceptance Criteria Status
From issue #363:
- [x] Logger utility enhanced with environment-aware defaults
- [x] Production console clean for migrated services
- [ ] All frontend services use Logger
- [ ] All frontend components use Logger
- [ ] All frontend plugins use Logger
- [ ] Backend library code uses tracing consistently

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Complete logging refactor: Migrate all console.* to Logger utility

## Changes
- Migrate 40+ files from console.* to Logger utility
- Remove unused performance-monitor.ts (dead code)
- Update tests to verify behavior instead of log output
  (Logger is intentionally silenced during tests)

## Files Modified
### Services (core migration)
- layout-persistence-service.ts
- tab-persistence-service.ts
- node-expansion-coordinator.ts
- optimistic-operation-manager.svelte.ts
- backend-adapter.ts
- cursor-positioning-service.ts
- keyboard-command-registry.ts
- tauri-sync-listener.ts
- shared-node-store.svelte.ts
- reactive-node-service.svelte.ts
- content-processor.ts
- performance-tracker.ts

### Components
- base-node.svelte, base-node-viewer.svelte
- app-shell.svelte, tab-system.svelte, pane-content.svelte
- backlinks-panel.svelte, custom-entity-node.svelte
- schema-property-form.svelte, task-schema-form.svelte
- autocomplete-modal.svelte, node-service-context.svelte
- cursor-positioning.ts

### Plugins & Utils
- plugin-registry.ts, core-plugins.ts
- database-write-queue.ts, marked-config.ts
- navigation.ts, layout.ts, reactive-structure-tree.svelte.ts

### Tests Updated
- core-plugins.test.ts, plugin-registry.test.ts
- keyboard-command-registry.test.ts, mcp-integration.test.ts
- shared-node-store.test.ts, database-write-queue.test.ts

## Remaining Console Statements (Intentional)
- logger.ts: The Logger utility itself
- developer-inspector.ts: Developer debugging tools
- JSDoc examples in documentation

Closes #363

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Address review: Fix minor formatting issues in logging

- Remove unused _isDev variable in logger.ts (YAGNI principle)
- Remove leading spaces from log messages in shared-node-store.svelte.ts
  (18 occurrences fixed for consistent output formatting)

Addresses reviewer recommendations from PR #733 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add logging standards to code quality documentation

Added comprehensive logging section to code-quality.md:
- Zero console.log policy with exemptions for tests and DeveloperInspector
- Logger utility usage examples with createLogger()
- Log levels table with production visibility guidance
- Environment behavior (production vs development vs test)
- Logger features (timing, grouping)
- Migration guide from raw console.* calls

Addresses "Nice to Have" acceptance criterion from issue #363:
"Logging documentation added to development guide"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add logging policy and link to code quality standards in CLAUDE.md

- Added link to docs/architecture/development/standards/code-quality.md
- Added Logging Policy section with quick reference to Logger utility
- Ensures AI agents are aware of logging standards

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 26, 2026
* WIP: Refactor logging to use Logger utility - Phase 1 complete

## Completed in This Session
- [x] Enhanced Logger utility with environment-aware defaults
  - Production: warn level (clean console)
  - Development: debug level (all logs)
  - Tests: disabled (better performance)
  - Added group(), groupEnd(), time() methods
- [x] Migrated key frontend services to Logger
  - browser-sync-service.ts (16 statements)
  - app-initialization.ts (5 statements)
  - navigation-service.ts (5 statements)
- [x] Migrated schema-plugin-loader.ts (6 statements)
- [x] Updated test expecting console.error (now uses logger)

## Remaining Work
- [ ] Migrate remaining services (shared-node-store, reactive-node-service, etc.)
- [ ] Migrate frontend components (~35 statements)
- [ ] Migrate node type files (~17 statements)
- [ ] Migrate remaining plugins (~3 statements)
- [ ] Standardize Rust backend tracing

## Current State
- Files modified: 7 (logger.ts, 4 services, 1 plugin, 1 test)
- Tests status: All 1569 passing
- Quality checks: Passing (eslint, svelte-check, clippy)
- Remaining console statements in lib: ~204 (down from 328+)

## Context for Next Session
The Logger utility is fully enhanced and working. Key services that were
causing production console noise are migrated. The remaining work is
methodical migration of:
1. Services with internal log() helpers (layout-persistence, tab-persistence, etc.)
2. Console.error/warn calls (appropriate levels, just need Logger consistency)
3. Components and node type files
4. Rust backend println!/eprintln! → tracing

## Acceptance Criteria Status
From issue #363:
- [x] Logger utility enhanced with environment-aware defaults
- [x] Production console clean for migrated services
- [ ] All frontend services use Logger
- [ ] All frontend components use Logger
- [ ] All frontend plugins use Logger
- [ ] Backend library code uses tracing consistently

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Complete logging refactor: Migrate all console.* to Logger utility

## Changes
- Migrate 40+ files from console.* to Logger utility
- Remove unused performance-monitor.ts (dead code)
- Update tests to verify behavior instead of log output
  (Logger is intentionally silenced during tests)

## Files Modified
### Services (core migration)
- layout-persistence-service.ts
- tab-persistence-service.ts
- node-expansion-coordinator.ts
- optimistic-operation-manager.svelte.ts
- backend-adapter.ts
- cursor-positioning-service.ts
- keyboard-command-registry.ts
- tauri-sync-listener.ts
- shared-node-store.svelte.ts
- reactive-node-service.svelte.ts
- content-processor.ts
- performance-tracker.ts

### Components
- base-node.svelte, base-node-viewer.svelte
- app-shell.svelte, tab-system.svelte, pane-content.svelte
- backlinks-panel.svelte, custom-entity-node.svelte
- schema-property-form.svelte, task-schema-form.svelte
- autocomplete-modal.svelte, node-service-context.svelte
- cursor-positioning.ts

### Plugins & Utils
- plugin-registry.ts, core-plugins.ts
- database-write-queue.ts, marked-config.ts
- navigation.ts, layout.ts, reactive-structure-tree.svelte.ts

### Tests Updated
- core-plugins.test.ts, plugin-registry.test.ts
- keyboard-command-registry.test.ts, mcp-integration.test.ts
- shared-node-store.test.ts, database-write-queue.test.ts

## Remaining Console Statements (Intentional)
- logger.ts: The Logger utility itself
- developer-inspector.ts: Developer debugging tools
- JSDoc examples in documentation

Closes #363

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Address review: Fix minor formatting issues in logging

- Remove unused _isDev variable in logger.ts (YAGNI principle)
- Remove leading spaces from log messages in shared-node-store.svelte.ts
  (18 occurrences fixed for consistent output formatting)

Addresses reviewer recommendations from PR #733 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add logging standards to code quality documentation

Added comprehensive logging section to code-quality.md:
- Zero console.log policy with exemptions for tests and DeveloperInspector
- Logger utility usage examples with createLogger()
- Log levels table with production visibility guidance
- Environment behavior (production vs development vs test)
- Logger features (timing, grouping)
- Migration guide from raw console.* calls

Addresses "Nice to Have" acceptance criterion from issue #363:
"Logging documentation added to development guide"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add logging policy and link to code quality standards in CLAUDE.md

- Added link to docs/architecture/development/standards/code-quality.md
- Added Logging Policy section with quick reference to Logger utility
- Ensures AI agents are aware of logging standards

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
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.

Refactor logging/debugging approach across codebase

1 participant