github.com/creativeprojects/go-selfupdate@v1.2.0/log.go (about) 1 package selfupdate 2 3 var log Logger = &emptyLogger{} 4 5 // SetLogger redirects all logs to the logger defined in parameter. 6 // By default logs are not sent anywhere. 7 func SetLogger(logger Logger) { 8 log = logger 9 } 10 11 // Logger interface. Compatible with standard log.Logger 12 type Logger interface { 13 // Print calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Print. 14 Print(v ...interface{}) 15 // Printf calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf. 16 Printf(format string, v ...interface{}) 17 } 18 19 // emptyLogger to discard all logs by default 20 type emptyLogger struct{} 21 22 func (l *emptyLogger) Print(v ...interface{}) {} 23 func (l *emptyLogger) Printf(format string, v ...interface{}) {}