diff --git a/irc/accounts.go b/irc/accounts.go index c4c86e17..f676cba2 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -99,7 +99,7 @@ func (am *AccountManager) buildNickToAccountIndex() { }) if err != nil { - am.server.logger.Error("internal", fmt.Sprintf("couldn't read reserved nicks: %v", err)) + am.server.logger.Error("internal", "couldn't read reserved nicks", err.Error()) } else { am.Lock() am.nickToAccount = result @@ -286,14 +286,14 @@ func (am *AccountManager) serializeCredentials(passphrase string, certfp string) bcryptCost := int(am.server.Config().Accounts.Registration.BcryptCost) creds.PassphraseHash, err = passwd.GenerateFromPassword([]byte(passphrase), bcryptCost) if err != nil { - am.server.logger.Error("internal", fmt.Sprintf("could not hash password: %v", err)) + am.server.logger.Error("internal", "could not hash password", err.Error()) return "", errAccountCreation } } credText, err := json.Marshal(creds) if err != nil { - am.server.logger.Error("internal", fmt.Sprintf("could not marshal credentials: %v", err)) + am.server.logger.Error("internal", "could not marshal credentials", err.Error()) return "", errAccountCreation } return string(credText), nil @@ -367,7 +367,7 @@ func (am *AccountManager) dispatchMailtoCallback(client *Client, casefoldedAccou // config.TLS.InsecureSkipVerify err = smtp.SendMail(addr, auth, config.Sender, []string{callbackValue}, message) if err != nil { - am.server.logger.Error("internal", fmt.Sprintf("Failed to dispatch e-mail: %v", err)) + am.server.logger.Error("internal", "Failed to dispatch e-mail", err.Error()) } return } @@ -619,7 +619,7 @@ func (am *AccountManager) deserializeRawAccount(raw rawClientAccount) (result Cl result.RegisteredAt = time.Unix(regTimeInt, 0) e := json.Unmarshal([]byte(raw.Credentials), &result.Credentials) if e != nil { - am.server.logger.Error("internal", fmt.Sprintf("could not unmarshal credentials: %v", e)) + am.server.logger.Error("internal", "could not unmarshal credentials", e.Error()) err = errAccountDoesNotExist return } @@ -628,7 +628,7 @@ func (am *AccountManager) deserializeRawAccount(raw rawClientAccount) (result Cl if raw.VHost != "" { e := json.Unmarshal([]byte(raw.VHost), &result.VHost) if e != nil { - am.server.logger.Warning("internal", fmt.Sprintf("could not unmarshal vhost for account %s: %v", result.Name, e)) + am.server.logger.Warning("internal", "could not unmarshal vhost for account", result.Name, e.Error()) // pretend they have no vhost and move on } } diff --git a/irc/channel.go b/irc/channel.go index 7144da9b..579d3fd6 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -48,7 +48,7 @@ type Channel struct { func NewChannel(s *Server, name string, regInfo *RegisteredChannel) *Channel { casefoldedName, err := CasefoldChannel(name) if err != nil { - s.logger.Error("internal", fmt.Sprintf("Bad channel name %s: %v", name, err)) + s.logger.Error("internal", "Bad channel name", name, err.Error()) return nil } diff --git a/irc/client_lookup_set.go b/irc/client_lookup_set.go index 65ed3a4b..e54e29b6 100644 --- a/irc/client_lookup_set.go +++ b/irc/client_lookup_set.go @@ -72,7 +72,7 @@ func (clients *ClientManager) removeInternal(client *Client) (err error) { delete(clients.byNick, oldcfnick) } else { // this shouldn't happen, but we can ignore it - client.server.logger.Warning("internal", fmt.Sprintf("clients for nick %s out of sync", oldcfnick)) + client.server.logger.Warning("internal", "clients for nick out of sync", oldcfnick) err = errNickMissing } } diff --git a/irc/handlers.go b/irc/handlers.go index d65d0280..6aca801f 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -367,7 +367,7 @@ func authErrorToMessage(server *Server, err error) (msg string) { if err == errAccountDoesNotExist || err == errAccountUnverified || err == errAccountInvalidCredentials { msg = err.Error() } else { - server.logger.Error("internal", fmt.Sprintf("sasl authentication failure: %v", err)) + server.logger.Error("internal", "sasl authentication failure", err.Error()) msg = "Unknown" } return diff --git a/irc/nickserv.go b/irc/nickserv.go index 72ca453e..37973e90 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -443,7 +443,7 @@ func nsPasswdHandler(server *Server, client *Client, command, params string, rb if err == nil { nsNotice(rb, client.t("Password changed")) } else { - server.logger.Error("internal", fmt.Sprintf("could not upgrade user password: %v", err)) + server.logger.Error("internal", "could not upgrade user password:", err.Error()) nsNotice(rb, client.t("Password could not be changed due to server error")) } } diff --git a/irc/server.go b/irc/server.go index 1afee925..5970f9b6 100644 --- a/irc/server.go +++ b/irc/server.go @@ -836,7 +836,7 @@ func (server *Server) setupPprofListener(config *Config) { } go func() { if err := ps.ListenAndServe(); err != nil { - server.logger.Error("rehash", fmt.Sprintf("pprof listener failed: %v", err)) + server.logger.Error("rehash", "pprof listener failed", err.Error()) } }() server.pprofServer = &ps