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 } }