Files
moby/cmd/dockerd/debug/debug.go
Gabriel Tomitsuka 44f19518f9 move the cli/debug package to cmd/dockerd/debug
Signed-off-by: Gabriel Tomitsuka <gabriel@tomitsuka.com>
2024-06-13 21:53:44 +00:00

27 lines
553 B
Go

package debug // import "github.com/docker/docker/cmd/dockerd/debug"
import (
"os"
"github.com/containerd/log"
)
// Enable sets the DEBUG env var to true
// and makes the logger to log at debug level.
func Enable() {
os.Setenv("DEBUG", "1")
_ = log.SetLevel("debug")
}
// Disable sets the DEBUG env var to false
// and makes the logger to log at info level.
func Disable() {
os.Setenv("DEBUG", "")
_ = log.SetLevel("info")
}
// IsEnabled checks whether the debug flag is set or not.
func IsEnabled() bool {
return os.Getenv("DEBUG") != ""
}