Files
moby/daemon/command/debug/debug.go
Derek McGowan ea11b5f3fe Move cmd/dockerd/debug to daemon/command/debug
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:02 -07:00

27 lines
498 B
Go

package 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") != ""
}