rdev/internal/logging/format.go
jordan d69da6d627 feat: add structured logging infrastructure and SDLC extensions
Major changes:
- Add internal/logging package with field constants, context propagation,
  sensitive data auto-redaction, and per-component log levels
- Add worker timeout constants (TimeoutQuickOp, TimeoutHealthCheck, etc.)
- Extend SDLC with callback handlers, generate endpoints, and executor
- Add new cookbook trees for aeries and slackpath progression
- Add skeleton templates for queue, realtime, and microservices
- Add worker component template with async job processing
- Refactor services and handlers to use new logging infrastructure
- Split component.go into component_infra.go and component_listing.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:56:04 -07:00

39 lines
804 B
Go

package logging
import "strings"
// Format represents the output format for logs.
type Format int
const (
// FormatJSON outputs structured JSON logs (production default).
FormatJSON Format = iota
// FormatText outputs human-readable text logs (development).
FormatText
)
// String returns the string representation of the format.
func (f Format) String() string {
switch f {
case FormatJSON:
return "json"
case FormatText:
return "text"
default:
return "json"
}
}
// ParseFormat parses a string into a Format.
// Returns FormatJSON if the string is not recognized.
func ParseFormat(s string) Format {
switch strings.ToLower(strings.TrimSpace(s)) {
case "text", "console", "dev":
return FormatText
case "json", "structured":
return FormatJSON
default:
return FormatJSON
}
}