MCPcopy Create free account
hub / github.com/Shopify/ghostferry / init

Function init

logger.go:76–90  ·  view source on GitHub ↗

stores LogBackendType

()

Source from the content-addressed store, hash-verified

74var activeBackend atomic.Value // stores LogBackendType
75
76func init() {
77 // Set the default before anything else runs.
78 activeBackend.Store(LogBackendLogrus)
79
80 if backend := os.Getenv("GHOSTFERRY_LOG_BACKEND"); backend != "" {
81 SetLogBackend(LogBackendType(backend))
82 }
83 if level := os.Getenv("GHOSTFERRY_LOG_LEVEL"); level != "" {
84 if parsed, ok := ParseLogLevel(level); ok {
85 SetLogLevel(parsed)
86 } else {
87 fmt.Fprintf(os.Stderr, "ghostferry: unknown log level %q from GHOSTFERRY_LOG_LEVEL, ignoring\n", level)
88 }
89 }
90}
91
92// getBackend returns the currently active backend type.
93func getBackend() LogBackendType {

Callers

nothing calls this directly

Calls 4

SetLogBackendFunction · 0.85
LogBackendTypeTypeAlias · 0.85
ParseLogLevelFunction · 0.85
SetLogLevelFunction · 0.85

Tested by

no test coverage detected