github.com/webdestroya/awsmocker@v0.2.6/globals.go (about)

     1  package awsmocker
     2  
     3  import (
     4  	"io"
     5  	"os"
     6  )
     7  
     8  var (
     9  	// Will Print out all the Request/Response traffic from the proxy
    10  	GlobalDebugMode = false
    11  
    12  	// where debugging output will go if requested
    13  	DebugOutputWriter io.Writer = os.Stdout
    14  )
    15  
    16  const (
    17  	envGlobalDebug = "AWSMOCKER_DEBUG"
    18  )
    19  
    20  func init() {
    21  	val, ok := os.LookupEnv(envGlobalDebug)
    22  	if ok && val != "false" {
    23  		GlobalDebugMode = true
    24  	}
    25  }
    26  
    27  func getDebugMode() bool {
    28  
    29  	// // this is "faster", but it breaks test caching, so keep the slow version
    30  	// if GlobalDebugMode {
    31  	// 	return true
    32  	// }
    33  
    34  	val, ok := os.LookupEnv(envGlobalDebug)
    35  	if ok && val != "false" {
    36  		return true
    37  	}
    38  
    39  	return GlobalDebugMode
    40  }