diff --git a/chdebug/debug.go b/chdebug/debug.go index 2bda2c4..0f0dd67 100644 --- a/chdebug/debug.go +++ b/chdebug/debug.go @@ -43,14 +43,17 @@ func WithWriter(w io.Writer) Option { // - CHDEBUG=0 - disables the hook. // - CHDEBUG=1 - enables the hook. // - CHDEBUG=2 - enables the hook and verbose mode. -func FromEnv(key string) Option { - if key == "" { - key = "CHDEBUG" +func FromEnv(keys ...string) Option { + if len(keys) == 0 { + keys = []string{"CHDEBUG"} } return func(h *QueryHook) { - if env, ok := os.LookupEnv(key); ok { - h.enabled = env != "" && env != "0" - h.verbose = env == "2" + for _, key := range keys { + if env, ok := os.LookupEnv(key); ok { + h.enabled = env != "" && env != "0" + h.verbose = env == "2" + break + } } } }