mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ce37550347
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
26 lines
517 B
Go
26 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") != ""
|
|
}
|