Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(msg string, args ...any)
- func DebugCtx(ctx context.Context, msg string, args ...any)
- func Error(msg string, args ...any)
- func ErrorCtx(ctx context.Context, msg string, args ...any)
- func Info(msg string, args ...any)
- func InfoCtx(ctx context.Context, msg string, args ...any)
- func Init(config Config) error
- func InitFromEnv() error
- func LogCompressionInfo(ctx context.Context, vendor string, originalSize, compressedSize int, ...)
- func LogError(ctx context.Context, component string, err error, details map[string]any)
- func LogMetrics(ctx context.Context, operation string, duration time.Duration, success bool, ...)
- func LogProxyRequest(ctx context.Context, originalModel, selectedVendor, selectedModel string, ...)
- func LogStreamingInfo(ctx context.Context, vendor, model string, chunkCount int)
- func LogValidationResult(ctx context.Context, vendor string, success bool, validationError error)
- func LogVendorResponse(ctx context.Context, vendor, actualModel, presentedModel string, ...)
- func SanitizeMap(data map[string]any) map[string]any
- func Warn(msg string, args ...any)
- func WarnCtx(ctx context.Context, msg string, args ...any)
- func WithContext(ctx context.Context) *slog.Logger
- type Config
Constants ¶
View Source
const ( LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError )
Logger levels
View Source
const ( RequestIDKey contextKey = "request_id" VendorKey contextKey = "vendor" ModelKey contextKey = "model" )
Variables ¶
View Source
var DefaultConfig = Config{ Level: LevelInfo, Format: "json", Output: "stdout", TimeFormat: time.RFC3339, }
Default configuration
View Source
var Logger *slog.Logger
Global logger instance
Functions ¶
func LogCompressionInfo ¶
func LogCompressionInfo(ctx context.Context, vendor string, originalSize, compressedSize int, compressionRatio float64)
LogCompressionInfo logs compression-related information
func LogMetrics ¶
func LogMetrics(ctx context.Context, operation string, duration time.Duration, success bool, details map[string]any)
LogMetrics logs performance metrics
func LogProxyRequest ¶
func LogProxyRequest(ctx context.Context, originalModel, selectedVendor, selectedModel string, totalCombinations int)
LogProxyRequest logs the initial proxy request with vendor selection
func LogStreamingInfo ¶
LogStreamingInfo logs streaming-related information
func LogValidationResult ¶
LogValidationResult logs response validation results
func LogVendorResponse ¶
func LogVendorResponse(ctx context.Context, vendor, actualModel, presentedModel string, responseSize int, processingTime time.Duration)
LogVendorResponse logs vendor response processing
func SanitizeMap ¶
Sanitize a map of data for logging
Types ¶
Click to show internal directories.
Click to hide internal directories.