github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/cmd/state-exec/internal/logr/logr.go (about)

     1  package logr
     2  
     3  type (
     4  	LogFunc func(format string, args ...interface{})
     5  )
     6  
     7  var (
     8  	Debug    LogFunc = Null
     9  	debugSet bool
    10  )
    11  
    12  func SetDebug(fn LogFunc) {
    13  	if debugSet {
    14  		return
    15  	}
    16  	Debug = fn
    17  	debugSet = true
    18  }
    19  
    20  func Null(format string, args ...interface{}) {}
    21  
    22  func CallIfDebugIsSet(fn func()) {
    23  	if !debugSet {
    24  		return
    25  	}
    26  	fn()
    27  }