Skip to content

refactor: replace tagged logging with structured logger#5

Open
JacobSampson wants to merge 1 commit into
mainfrom
APR-211/structured-logging
Open

refactor: replace tagged logging with structured logger#5
JacobSampson wants to merge 1 commit into
mainfrom
APR-211/structured-logging

Conversation

@JacobSampson

Copy link
Copy Markdown
Contributor

Summary

Replaces tagged logging with a structured logger utility across all daemon modules.

Changes

  • New: packages/apprentice/src/utils/logger.tscreateLogger() factory producing namespaced, leveled loggers
  • Updated: 5 files migrated to structured logging:
    • utils/dotenv.ts[dotenv], [dotenv:debug], [dotenv:warn]log.info/debug/warn
    • daemon/agent-runner.ts[AgentRunner], [Agent] → two separate namespaced loggers
    • daemon/adapters/discord.ts[Discord]log.info/debug/error
    • daemon/index.ts[Daemon]log.info/debug/warn/error
    • daemon/progress-monitor.ts[ProgressMonitor]log.info/error

Structured log format

All logs now use a consistent format:

[2026-06-12T10:30:00.000Z] [INFO] [Daemon] Session created {"sessionId":"abc123"}

Benefits:

  • Timestamps on every log line
  • Explicit log levels (debug/info/warn/error) for filtering
  • Structured context as JSON instead of string interpolation
  • Consistent namespace format across modules
  • Level-based filtering (debug logs suppressed in production by default)

Pre-existing issues

The repo has pre-existing type errors in daemon/config.ts, indexer.ts, and search/hybrid.ts — these are unrelated to this change.

Refs: APR-211

… modules

- Add utils/logger.ts with createLogger() for structured, leveled logging
- Replace [dotenv], [dotenv:debug], [dotenv:warn] tags with logger.info/debug/warn
- Replace [AgentRunner], [Agent] tags with leveled logger calls
- Replace [Discord] tags with leveled logger calls
- Replace [Daemon] tags with leveled logger calls
- Replace [ProgressMonitor] tags with leveled logger calls

All logs now use consistent format: [timestamp] [LEVEL] [namespace] message context

Refs: APR-211
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