feat(GODT-2502): Additional info.

This commit is contained in:
Jakub
2023-04-14 10:10:58 +02:00
parent 7bb925b6d7
commit 8093bbf5f6
3 changed files with 15 additions and 1 deletions

View File

@ -248,6 +248,7 @@ func run(c *cli.Context) error {
"lastVersion": v.GetLastVersion().String(),
"showAllMail": v.GetShowAllMail(),
"updateCh": v.GetUpdateChannel(),
"autoUpdate": v.GetAutoUpdate(),
"rollout": v.GetUpdateRollout(),
"DoH": v.GetProxyAllowed(),
}).Info("Vault loaded")

View File

@ -23,6 +23,7 @@ import (
"github.com/ProtonMail/proton-bridge/v3/internal/safe"
"github.com/emersion/go-smtp"
"github.com/sirupsen/logrus"
)
type smtpBackend struct {
@ -85,7 +86,7 @@ func (s *smtpSession) Rcpt(to string) error {
}
func (s *smtpSession) Data(r io.Reader) error {
return safe.RLockRet(func() error {
err := safe.RLockRet(func() error {
user, ok := s.users[s.userID]
if !ok {
return ErrNoSuchUser
@ -93,4 +94,10 @@ func (s *smtpSession) Data(r io.Reader) error {
return user.SendMail(s.authID, s.from, s.to, r)
}, s.usersLock)
if err != nil {
logrus.WithField("pkg", "smtp").WithError(err).Error("Send mail failed.")
}
return err
}

View File

@ -119,6 +119,12 @@ func New(
return nil, fmt.Errorf("failed to get labels: %w", err)
}
logrus.WithFields(logrus.Fields{
"userID": apiUser.ID,
"numAddr": len(apiAddrs),
"numLabels": len(apiLabels),
}).Info("Creating user object")
// Create the user object.
user := &User{
log: logrus.WithField("userID", apiUser.ID),