1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
// vlog -- verbose logger -- wraps log functions and only performs them if "verbose" package vlog import ( "fmt" ) var VERBOSE bool func init() { VERBOSE=false } func Printf(format string, v ...interface{}) { if VERBOSE { fmt.Printf(format, v...) } } func Println(v ...interface{}) { if VERBOSE { fmt.Println(v...) } }