Remove Logger.Print

Callers can just use Logger.Printf instead.
This commit is contained in:
Simon Ser 2021-12-06 18:27:36 +01:00
parent f881a42b4b
commit 7dd884d3da

View File

@ -37,7 +37,6 @@ var chatHistoryLimit = 1000
var backlogLimit = 4000 var backlogLimit = 4000
type Logger interface { type Logger interface {
Print(v ...interface{})
Printf(format string, v ...interface{}) Printf(format string, v ...interface{})
} }
@ -48,11 +47,6 @@ type prefixLogger struct {
var _ Logger = (*prefixLogger)(nil) var _ Logger = (*prefixLogger)(nil)
func (l *prefixLogger) Print(v ...interface{}) {
v = append([]interface{}{l.prefix}, v...)
l.logger.Print(v...)
}
func (l *prefixLogger) Printf(format string, v ...interface{}) { func (l *prefixLogger) Printf(format string, v ...interface{}) {
v = append([]interface{}{l.prefix}, v...) v = append([]interface{}{l.prefix}, v...)
l.logger.Printf("%v"+format, v...) l.logger.Printf("%v"+format, v...)
@ -296,12 +290,12 @@ func (s *Server) handle(ic ircConn) {
dc := newDownstreamConn(s, ic, id) dc := newDownstreamConn(s, ic, id)
if err := dc.runUntilRegistered(); err != nil { if err := dc.runUntilRegistered(); err != nil {
if !errors.Is(err, io.EOF) { if !errors.Is(err, io.EOF) {
dc.logger.Print(err) dc.logger.Printf("%v", err)
} }
} else { } else {
dc.user.events <- eventDownstreamConnected{dc} dc.user.events <- eventDownstreamConnected{dc}
if err := dc.readMessages(dc.user.events); err != nil { if err := dc.readMessages(dc.user.events); err != nil {
dc.logger.Print(err) dc.logger.Printf("%v", err)
} }
dc.user.events <- eventDownstreamDisconnected{dc} dc.user.events <- eventDownstreamDisconnected{dc}
} }