feat(logging): implement leveled logger with timestamp prefixes #176
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/ttheart!176
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/implement-logging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implement a leveled logger in
logging/logger.gowrapping the standardlogpackage:Info()— informational messages with[INFO]prefix and timestampWarn()— warning messages with[WARN]prefix and timestampError()— error messages with[ERROR]prefix and timestampNew()— default constructor writing toos.StdoutNewFromWriter()— configurable writer for testing and custom outputWhy
Centralized logging is required by the project conventions. All components (webhook handler, rule matcher, executor) will use this logger for consistent, leveled output.
Testing
go test ./...and pre-commit passlogger_test.gowith table-driven testsBreaking Changes
None.
Notes
log.LstdFlagsfor date/time prefix on every linepackage logging_test) for public API testinglogging/directoryCloses #25
Closes #22
Closes #23
Closes #24
Review
Clean implementation of a leveled logger. Lint, vet, and tests all pass with zero issues.
Design: Logger wraps
log.Newwith separate instances per level. Prefix spacing aligns output nicely:Uses
log.LstdFlagsfor timestamp prefixes.New()writes toos.Stdout,NewFromWriter()allows writer injection.Tests: Table-driven, covers all three levels, verifies both prefix and formatted message via pipe capture. External test package — proper for public API testing.
Non-blocking
logger.go:26—NewFromWriteraccepts*os.Filebut should acceptio.Writerfor flexibility. Filed as #177.No blocking issues.
APPROVED