avoid some uses of Sprintf for loglines

This commit is contained in:
Shivaram Lingamneni 2018-12-31 11:33:42 -05:00
parent ec4f1c189a
commit c2b2559ab4
6 changed files with 11 additions and 11 deletions

View file

@ -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
}
}