github.com/ks888/tgo@v0.0.0-20190130135156-80bf89407292/log/logger.go (about)

     1  package log
     2  
     3  import "log"
     4  
     5  // EnableDebugLog is the flag to enable the debug log
     6  var EnableDebugLog = false
     7  
     8  // Print is the wrapper function of the standard log.Print
     9  func Print(v ...interface{}) {
    10  	log.Print(v...)
    11  }
    12  
    13  // Printf is the wrapper function of the standard log.Printf
    14  func Printf(format string, v ...interface{}) {
    15  	log.Printf(format, v...)
    16  }
    17  
    18  // Println is the wrapper function of the standard log.Println
    19  func Println(v ...interface{}) {
    20  	log.Println(v...)
    21  }
    22  
    23  // Debug calls standard log.Print function if the `EnableDebugLog` is true
    24  func Debug(v ...interface{}) {
    25  	if EnableDebugLog {
    26  		log.Print(v...)
    27  	}
    28  }
    29  
    30  // Debugf calls standard log.Printf function if the `EnableDebugLog` is true
    31  func Debugf(format string, v ...interface{}) {
    32  	if EnableDebugLog {
    33  		log.Printf(format, v...)
    34  	}
    35  }
    36  
    37  // Debugln calls standard log.Println function if the `EnableDebugLog` is true
    38  func Debugln(v ...interface{}) {
    39  	if EnableDebugLog {
    40  		log.Println(v...)
    41  	}
    42  }
    43  
    44  func init() {
    45  	log.SetFlags(0)
    46  }