Other: Add some more debug logs

This commit is contained in:
James Houlahan
2022-11-01 15:00:52 +01:00
parent 1ad821b2b7
commit 924a423488
5 changed files with 74 additions and 4 deletions

View File

@ -31,6 +31,7 @@ import (
"github.com/ProtonMail/proton-bridge/v2/internal/certs"
"github.com/bradenaw/juniper/xslices"
"github.com/sirupsen/logrus"
"github.com/vmihailenco/msgpack/v5"
)
@ -184,6 +185,8 @@ func (vault *Vault) attachUser(userID string) *User {
vault.refLock.Lock()
defer vault.refLock.Unlock()
logrus.WithField("userID", userID).Trace("Attaching vault user")
vault.ref[userID]++
return &User{
@ -196,6 +199,8 @@ func (vault *Vault) detachUser(userID string) error {
vault.refLock.Lock()
defer vault.refLock.Unlock()
logrus.WithField("userID", userID).Trace("Detaching vault user")
if _, ok := vault.ref[userID]; !ok {
return fmt.Errorf("user %s is not attached", userID)
}