github.com/glycerine/xcryptossh@v7.0.4+incompatible/verbose.go (about)

     1  package ssh
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  )
     7  
     8  // debug printing utilities
     9  
    10  var verbose bool = false
    11  
    12  func p(format string, a ...interface{}) {
    13  	if verbose {
    14  		tsPrintf(format, a...)
    15  	}
    16  }
    17  
    18  // quiet: discard text
    19  func q(format string, a ...interface{}) {}
    20  
    21  func pp(format string, a ...interface{}) {
    22  	tsPrintf(format, a...)
    23  }
    24  
    25  func ppp(format string, a ...interface{}) {
    26  	fmt.Printf("\n"+format+"\n", a...)
    27  }
    28  
    29  // time-stamped printf
    30  func tsPrintf(format string, a ...interface{}) {
    31  	fmt.Printf("\n%s ", ts())
    32  	fmt.Printf(format+"\n", a...)
    33  }
    34  
    35  // get timestamp for logging purposes
    36  func ts() string {
    37  	return time.Now().Format("2006-01-02 15:04:05.999 -0700 MST")
    38  }