mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
avoid some uses of Sprintf for loglines
This commit is contained in:
parent
ec4f1c189a
commit
c2b2559ab4
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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"))
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user