stores LogBackendType
()
| 74 | var activeBackend atomic.Value // stores LogBackendType |
| 75 | |
| 76 | func 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. |
| 93 | func getBackend() LogBackendType { |
nothing calls this directly
no test coverage detected