Get the value of a boolean environment variable
(which string)
| 92 | |
| 93 | // Get the value of a boolean environment variable |
| 94 | func debugEnv(which string) (isAvail bool, value bool) { |
| 95 | envvar := "DEBUG_" + strings.ToUpper(which) |
| 96 | env := os.Getenv(envvar) |
| 97 | if env == "" { |
| 98 | return false, false |
| 99 | } |
| 100 | i, err := strconv.Atoi(env) |
| 101 | if err != nil { |
| 102 | return true, false |
| 103 | } |
| 104 | if i == 0 { |
| 105 | return true, false |
| 106 | } |
| 107 | logInfo(context.Background(), "%s is ENABLED", envvar) |
| 108 | return true, true |
| 109 | } |
| 110 | |
| 111 | // Log functions with printf-style args |
| 112 | var debugLoggerFunc LogFunc |
no test coverage detected