github.com/go/docker@v1.12.0-rc2/utils/debug.go (about)

     1  package utils
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/Sirupsen/logrus"
     7  )
     8  
     9  // EnableDebug sets the DEBUG env var to true
    10  // and makes the logger to log at debug level.
    11  func EnableDebug() {
    12  	os.Setenv("DEBUG", "1")
    13  	logrus.SetLevel(logrus.DebugLevel)
    14  }
    15  
    16  // DisableDebug sets the DEBUG env var to false
    17  // and makes the logger to log at info level.
    18  func DisableDebug() {
    19  	os.Setenv("DEBUG", "")
    20  	logrus.SetLevel(logrus.InfoLevel)
    21  }
    22  
    23  // IsDebugEnabled checks whether the debug flag is set or not.
    24  func IsDebugEnabled() bool {
    25  	return os.Getenv("DEBUG") != ""
    26  }