Skip to content

Commit

Permalink
fix: Log IMAP literals with append
Browse files Browse the repository at this point in the history
We can now inspect the full message on append.
  • Loading branch information
LBeernaertProton committed Nov 1, 2022
1 parent 64ae49d commit 6072c69
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/session/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package session

import (
"context"
"fmt"
"github.com/bradenaw/juniper/xslices"
"golang.org/x/exp/maps"

"github.com/ProtonMail/gluon/internal/parser/proto"
"github.com/ProtonMail/gluon/internal/response"
Expand Down Expand Up @@ -62,7 +65,15 @@ func (s *Session) readCommand(del string) (string, *proto.Command, error) {
return "", nil, err
}

s.logIncoming(string(line))
if len(literals) == 0 {
s.logIncoming(string(line))
} else {
s.logIncoming(fmt.Sprintf("%v Literals: %v", string(line),
xslices.Map(maps.Keys(literals), func(k string) string {
return fmt.Sprintf("%v: '%v'", k, string(literals[k]))
}),
))
}

tag, cmd, err := parse(line, literals, del)
if err != nil {
Expand Down

0 comments on commit 6072c69

Please sign in to comment.