Commit graph

11 commits

Author SHA1 Message Date
Claude
44223f0c67
ax(logging): rename mu to mutex for predictable naming
AX Principle 1: abbreviated field names increase semantic ambiguity.
Logger.mu renamed to Logger.mutex — no comment required to understand it.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:22:38 +01:00
Claude
3b077dd00d
ax(logging): add missing function name to GetLevel doc comment
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:21:20 +01:00
Claude
cb07aa01e3
ax(logging): replace prose comment with usage example on GetLevel
GetLevel had a comment that restated the signature in prose ("returns the
current minimum log level"), violating AX Principle 2. Replaced with a
concrete call-site example showing how the result is actually used.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:20:03 +01:00
Claude
8d323f7570
ax(logging): rename TestLoggerLevels/TestLoggerDebugLevel to TestFilename_Function_{Good,Bad,Ugly}
Some checks failed
Test / test (push) Has been cancelled
Security Scan / security (push) Has been cancelled
AX test naming rule: TestFilename_Function_{Good,Bad,Ugly} — all three
categories mandatory. Splits the single test into the three required forms.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:19:05 +01:00
Claude
1670659bba
ax(logging): replace prose comment on GetLevel with usage example
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
"GetLevel returns the current log level" restates the signature —
exactly what AX Principle 2 says to delete. Replaced with a concrete
usage example showing how a caller would inspect and conditionally
adjust the level.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:17:50 +01:00
Claude
5bfffbdec9
ax(logging): replace prose comment on WithComponent with usage example
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:16:29 +01:00
Claude
5b7c84142e
ax(logging): replace signature-restatement comment with usage example on SetLevel
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:15:18 +01:00
Claude
df3a641f5f
ax(logging): replace prose comments with usage examples on global functions
AX Principle 2 — global convenience functions had comments restating the
signature ("logs a debug message using the global logger") rather than
showing concrete calls with realistic values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:14:21 +01:00
Claude
7d6d00a0e6
ax(logging): replace prose comment on New with usage example
AX Principle 2: comments must show concrete usage, not restate the
function name. "New creates a new Logger with the given configuration"
restated the signature — replaced with a callable example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:13:04 +01:00
Claude
230c07adf3
ax(logging): rename globalMu/sb to globalMutex/builder
Abbreviated names `globalMu` and `sb` require a comment to understand
their purpose, violating AX Principle 1 (Predictable Names Over Short
Names). Renamed `globalMu` to `globalMutex` and `sb` to `builder`
throughout logger.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:11:47 +01:00
snider
ddcf39b7ee feat: Add structured logging package
Create pkg/logging with:
- Log levels: Debug, Info, Warn, Error
- Structured fields support (key-value pairs)
- Component-based logging (WithComponent)
- Global logger convenience functions
- ParseLevel for configuration
- Full test coverage

The package provides a migration path from log.Printf to
structured logging without external dependencies.

Example usage:
  logging.Info("miner started", logging.Fields{"name": minerName})
  logger := logging.New(cfg).WithComponent("Manager")
  logger.Warn("connection lost", logging.Fields{"pool": pool})

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 11:18:22 +00:00