Skip to content

feat(logging): add structured logging with slog and charmbracelet/log#59

Merged
jmgilman merged 2 commits intomasterfrom
feat/structured-logging
Jan 5, 2026
Merged

feat(logging): add structured logging with slog and charmbracelet/log#59
jmgilman merged 2 commits intomasterfrom
feat/structured-logging

Conversation

@jmgilman
Copy link
Collaborator

@jmgilman jmgilman commented Jan 5, 2026

Summary

  • Added global -v flag for verbosity control (-v for info, -vv for debug)
  • Created internal/slogger package using Go's slog with charmbracelet/log handler
  • Converted command output from fmt.Printf to structured slog messages
  • Added debug logging throughout instance, container, and git operations

Verbosity Levels

Flag Level Output
(none) Error Errors only (quiet default)
-v Info Key operations (instance created, session started)
-vv Debug Detailed diagnostics (container ops, git ops)

Test plan

  • just check passes (format, lint, tests)
  • Manual test: hjk run <branch> shows no output by default
  • Manual test: hjk -v run <branch> shows info messages
  • Manual test: hjk -vv run <branch> shows debug messages

🤖 Generated with Claude Code

jmgilman and others added 2 commits January 5, 2026 12:42
Current behavior:
CLI output was limited to fmt.Printf statements with no verbosity control,
making troubleshooting difficult when operations failed silently.

New behavior:
Integrated structured logging throughout the CLI stack using Go's slog
with charmbracelet/log as the handler for pleasant terminal output.

- Added global -v flag (stackable: -v for info, -vv for debug)
- Default verbosity is quiet (errors only)
- Created internal/slogger package for logger initialization
- Converted command output to slog Info messages
- Added Debug logging to instance, container, and git operations
- All logging outputs to stderr (command data stays on stdout)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Current behavior:
All user-facing messages (instance created, session created, etc.)
were converted to slog which outputs to stderr, causing integration
tests to fail because they expect these messages on stdout.

New behavior:
User-facing command results (e.g., "Instance ready", "Stopped instance")
go to stdout via fmt.Printf, while debug/diagnostic logging stays on
stderr via slog. This follows CLI conventions where command output goes
to stdout and diagnostics/errors go to stderr.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 5, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
headjack 69eee3e Commit Preview URL

Branch Preview URL
Jan 05 2026, 09:04 PM

@jmgilman jmgilman merged commit 13abf1d into master Jan 5, 2026
4 checks passed
@jmgilman jmgilman deleted the feat/structured-logging branch January 5, 2026 21:04
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