Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JSONLLogger ¶
type JSONLLogger struct {
// contains filtered or unexported fields
}
JSONLLogger logs in JSON Lines format
func NewJSONLLogger ¶
func NewJSONLLogger(w io.Writer) *JSONLLogger
NewJSONLLogger creates a new JSONL logger
func (*JSONLLogger) LogError ¶
func (l *JSONLLogger) LogError(msg string, err error)
LogError logs an error with JSONL format
func (*JSONLLogger) LogHeaders ¶
func (l *JSONLLogger) LogHeaders(r *http.Request)
LogHeaders logs request headers with JSONL format WARNING: This may log sensitive data (e.g., Authorization headers). Only enable header logging in development or when debugging specific issues.
func (*JSONLLogger) LogInfo ¶
func (l *JSONLLogger) LogInfo(msg string)
LogInfo logs an informational message with JSONL format
func (*JSONLLogger) LogRequest ¶
LogRequest logs an HTTP request with JSONL format
type LogEntry ¶
type LogEntry struct {
Timestamp string `json:"timestamp"`
Level string `json:"level"`
Message string `json:"message,omitempty"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Status int `json:"status,omitempty"`
Duration string `json:"duration,omitempty"`
Headers map[string]interface{} `json:"headers,omitempty"`
Error string `json:"error,omitempty"`
}
LogEntry represents a structured log entry
type Logger ¶
type Logger interface {
LogRequest(r *http.Request, status int, duration time.Duration)
LogError(msg string, err error)
LogInfo(msg string)
LogHeaders(r *http.Request)
}
Logger interface for flexible logging
type TextLogger ¶
type TextLogger struct {
// contains filtered or unexported fields
}
TextLogger logs in traditional text format
func (*TextLogger) LogError ¶
func (l *TextLogger) LogError(msg string, err error)
LogError logs an error with text format
func (*TextLogger) LogHeaders ¶
func (l *TextLogger) LogHeaders(r *http.Request)
LogHeaders logs request headers with text format WARNING: This may log sensitive data (e.g., Authorization headers). Only enable header logging in development or when debugging specific issues.
func (*TextLogger) LogInfo ¶
func (l *TextLogger) LogInfo(msg string)
LogInfo logs an informational message with text format
func (*TextLogger) LogRequest ¶
LogRequest logs an HTTP request with text format