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{}) {}