github.com/devops-filetransfer/sshego@v7.0.4+incompatible/cmd/gosshtun/verbose.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "time" 6 ) 7 8 // Verbose can be set to true for debug output. For production builds it 9 // should be set to false, the default. 10 var VerboseMain bool 11 12 // Ts gets the current timestamp for logging purposes. 13 func Ts() string { 14 return time.Now().Format("2006-01-02 15:04:05.999 -0700 MST") 15 } 16 17 // time-stamped fmt.Printf 18 func TSPrintf(format string, a ...interface{}) { 19 fmt.Printf("\n%s ", Ts()) 20 fmt.Printf(format+"\n", a...) 21 } 22 23 // VPrintf is like fmt.Printf, but only prints if Verbose is true. Uses TSPrint 24 // to mark each print with a timestamp. 25 func p(format string, a ...interface{}) { 26 if VerboseMain { 27 TSPrintf(format, a...) 28 } 29 }