account service: improve logging
This commit is contained in:
parent
fd3b2a0dba
commit
8bd1c556fb
2 changed files with 23 additions and 12 deletions
|
|
@ -97,22 +97,33 @@ func (s *AccountService) ChangeAvatarURL(id string, avatarURL string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *AccountService) Delete(accountID string) error {
|
||||
return s.repo.Delete(accountID)
|
||||
func (s *AccountService) Delete(id string) error {
|
||||
if err := s.repo.Delete(id); err != nil { return err }
|
||||
s.log.Printf("Deleted account %s", id)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AccountService) IncrementFails(accountID string) (int, error) {
|
||||
return s.repo.IncrementFails(accountID)
|
||||
func (s *AccountService) IncrementFails(id string) (int, error) {
|
||||
num, err := s.repo.IncrementFails(id)
|
||||
if err != nil { return 0, err }
|
||||
s.log.Printf("Incremented auth failures for account %s (now %d)", id, num)
|
||||
return num, nil
|
||||
}
|
||||
|
||||
func (s *AccountService) ResetFails(accountID string) (error) {
|
||||
return s.repo.ResetFails(accountID)
|
||||
func (s *AccountService) ResetFails(id string) (error) {
|
||||
if err := s.repo.ResetFails(id); err != nil { return err }
|
||||
s.log.Printf("Reset auth failures for account %s", id)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AccountService) Lock(accountID string) error {
|
||||
return s.repo.Lock(accountID)
|
||||
func (s *AccountService) Lock(id string) error {
|
||||
if err := s.repo.Lock(id); err != nil { return err }
|
||||
s.log.Printf("Locked account %s", id)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AccountService) Unlock(accountID string) error {
|
||||
return s.repo.Unlock(accountID)
|
||||
func (s *AccountService) Unlock(id string) error {
|
||||
if err := s.repo.Unlock(id); err != nil { return err }
|
||||
s.log.Printf("Locked account %s", id)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue