Files
docker-cli/components/engine/cli/debug/debug.go
Vincent Demeester 38517bb088 Move debug functions to cli/debug package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: ce375503477c82a76ce8530e73655fbbf5046834
Component: engine
2016-12-12 09:33:58 +01:00

27 lines
517 B
Go

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