You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

44 lines
1.2 KiB

package rabbitmq
import (
"fmt"
"log"
)
// Logger is the interface to send logs to. It can be set using
// WithPublisherOptionsLogger() or WithConsumerOptionsLogger().
type Logger interface {
Fatalf(string, ...interface{})
Errorf(string, ...interface{})
Warnf(string, ...interface{})
Infof(string, ...interface{})
Debugf(string, ...interface{})
Tracef(string, ...interface{})
}
const loggingPrefix = "gorabbit"
// stdDebugLogger logs to stdout up to the `DebugF` level
type stdDebugLogger struct{}
func (l stdDebugLogger) Fatalf(format string, v ...interface{}) {
log.Printf(fmt.Sprintf("%s FATAL: %s", loggingPrefix, format), v...)
}
func (l stdDebugLogger) Errorf(format string, v ...interface{}) {
log.Printf(fmt.Sprintf("%s ERROR: %s", loggingPrefix, format), v...)
}
func (l stdDebugLogger) Warnf(format string, v ...interface{}) {
log.Printf(fmt.Sprintf("%s WARN: %s", loggingPrefix, format), v...)
}
func (l stdDebugLogger) Infof(format string, v ...interface{}) {
log.Printf(fmt.Sprintf("%s INFO: %s", loggingPrefix, format), v...)
}
func (l stdDebugLogger) Debugf(format string, v ...interface{}) {
log.Printf(fmt.Sprintf("%s DEBUG: %s", loggingPrefix, format), v...)
}
func (l stdDebugLogger) Tracef(format string, v ...interface{}) {}