dump.go 362 B

123456789101112131415161718192021222324252627
  1. package debug
  2. import (
  3. "os"
  4. "github.com/davecgh/go-spew/spew"
  5. "github.com/kyleconroy/sqlc/internal/opts"
  6. )
  7. var Active bool
  8. var Traced bool
  9. var Debug opts.Debug
  10. func init() {
  11. Active = os.Getenv("SQLCDEBUG") != ""
  12. if Active {
  13. Debug = opts.DebugFromEnv()
  14. Traced = Debug.Trace != ""
  15. }
  16. }
  17. func Dump(n ...interface{}) {
  18. if Active {
  19. spew.Dump(n)
  20. }
  21. }