mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 07:54:40 +03:00
when logging email addresses with IDNA domain and/or special characters or utf8 in localpart, log both native utf8 form and form with escape localpart and ascii-only domain
the idea is to make it clear from the logging if non-ascii characters are used. this is implemented by making mlog recognize if a field value that will be logged has a LogString method. if so, that value is logged. dns.Domain, smtp.Address, smtp.Localpart, smtp.Path now have a LogString method. some explicit calls to String have been replaced to LogString, and some %q formatting have been replaced with %s, because the escaped localpart would already have double quotes, and double doublequotes aren't easy to read.
This commit is contained in:
2
ctl.go
2
ctl.go
@ -397,7 +397,7 @@ func servectlcmd(ctx context.Context, log *mlog.Log, ctl *ctl, xcmd *string, shu
|
||||
if qm.LastAttempt != nil {
|
||||
lastAttempt = time.Since(*qm.LastAttempt).Round(time.Second).String()
|
||||
}
|
||||
fmt.Fprintf(xw, "%5d %s from:%s@%s to:%s@%s next %s last %s error %q\n", qm.ID, qm.Queued.Format(time.RFC3339), qm.SenderLocalpart, qm.SenderDomain, qm.RecipientLocalpart, qm.RecipientDomain, -time.Since(qm.NextAttempt).Round(time.Second), lastAttempt, qm.LastError)
|
||||
fmt.Fprintf(xw, "%5d %s from:%s to:%s next %s last %s error %q\n", qm.ID, qm.Queued.Format(time.RFC3339), qm.Sender().LogString(), qm.Recipient().LogString(), -time.Since(qm.NextAttempt).Round(time.Second), lastAttempt, qm.LastError)
|
||||
}
|
||||
if len(qmsgs) == 0 {
|
||||
fmt.Fprint(xw, "(empty)\n")
|
||||
|
Reference in New Issue
Block a user