MCPcopy Create free account
hub / github.com/PostHog/duckgres / parseLogLevel

Function parseLogLevel

internal/cliboot/logging.go:246–261  ·  view source on GitHub ↗

parseLogLevel returns the slog.Level for the DUCKGRES_LOG_LEVEL env var. Supported values: debug, info, warn, error. Defaults to info.

()

Source from the content-addressed store, hash-verified

244 )
245 if err != nil {
246 fmt.Fprintf(os.Stderr, "Failed to create PostHog log exporter for key %s…: %v\n", apiKey[:min(8, len(apiKey))], err)
247 return nil
248 }
249 return exporter
250}
251
252// parseLogLevel returns the slog.Level for the DUCKGRES_LOG_LEVEL env var.
253// Supported values: debug, info, warn, error. Defaults to info.
254func parseLogLevel() slog.Level {
255 val := strings.ToLower(os.Getenv("DUCKGRES_LOG_LEVEL"))
256 switch val {
257 case "debug":
258 return slog.LevelDebug
259 case "warn", "warning":
260 return slog.LevelWarn
261 case "error":
262 return slog.LevelError
263 case "info", "":
264 return slog.LevelInfo

Callers 1

InitLoggingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected