mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 08:23:48 +03:00
consistently use lower-cased field names for logging lines
This commit is contained in:
parent
0ede7f78c1
commit
26fcaa17f5
7 changed files with 15 additions and 15 deletions
|
@ -718,14 +718,14 @@ func (f *Filter) TrainDirs(hamDir, sentDir, spamDir string, hamFiles, sentFiles,
|
|||
|
||||
fields := []mlog.Pair{
|
||||
mlog.Field("hams", hams),
|
||||
mlog.Field("hamTime", tham),
|
||||
mlog.Field("hamMalformed", hamMalformed),
|
||||
mlog.Field("hamtime", tham),
|
||||
mlog.Field("hammalformed", hamMalformed),
|
||||
mlog.Field("sent", sent),
|
||||
mlog.Field("sentTime", tsent),
|
||||
mlog.Field("sentMalformed", sentMalformed),
|
||||
mlog.Field("senttime", tsent),
|
||||
mlog.Field("sentmalformed", sentMalformed),
|
||||
mlog.Field("spams", f.spams),
|
||||
mlog.Field("spamTime", tspam),
|
||||
mlog.Field("spamMalformed", spamMalformed),
|
||||
mlog.Field("spamtime", tspam),
|
||||
mlog.Field("spammalformed", spamMalformed),
|
||||
mlog.Field("dbsize", fmt.Sprintf("%.1fmb", float64(dbSize)/(1024*1024))),
|
||||
mlog.Field("bloomsize", fmt.Sprintf("%.1fmb", float64(bloomSize)/(1024*1024))),
|
||||
mlog.Field("bloom1ratio", fmt.Sprintf("%.4f", float64(f.bloom.Ones())/float64(len(f.bloom.Bytes())*8))),
|
||||
|
|
|
@ -442,7 +442,7 @@ func queueDelete(msgID int64) error {
|
|||
// message, or updating the time for the next attempt. A DSN may be sent.
|
||||
func deliver(resolver dns.Resolver, m Msg) {
|
||||
cid := mox.Cid()
|
||||
qlog := xlog.WithCid(cid).Fields(mlog.Field("from", m.Sender()), mlog.Field("recipient", m.Recipient()), mlog.Field("attempts", m.Attempts), mlog.Field("msgID", m.ID))
|
||||
qlog := xlog.WithCid(cid).Fields(mlog.Field("from", m.Sender()), mlog.Field("recipient", m.Recipient()), mlog.Field("attempts", m.Attempts), mlog.Field("msgid", m.ID))
|
||||
|
||||
defer func() {
|
||||
deliveryResult <- formatIPDomain(m.RecipientDomain)
|
||||
|
@ -492,7 +492,7 @@ func deliver(resolver dns.Resolver, m Msg) {
|
|||
qup := bstore.QueryDB[Msg](queueDB)
|
||||
qup.FilterID(m.ID)
|
||||
if _, err := qup.UpdateNonzero(Msg{LastError: errmsg, DialedIPs: m.DialedIPs}); err != nil {
|
||||
qlog.Errorx("storing delivery error", err, mlog.Field("deliveryError", errmsg))
|
||||
qlog.Errorx("storing delivery error", err, mlog.Field("deliveryerror", errmsg))
|
||||
}
|
||||
|
||||
if m.Attempts == 5 {
|
||||
|
@ -705,7 +705,7 @@ func deliverHost(log *mlog.Log, resolver dns.Resolver, cid int64, host dns.IPDom
|
|||
var deliveryResult string
|
||||
defer func() {
|
||||
metricDeliveryHost.WithLabelValues(fmt.Sprintf("%d", m.Attempts), string(tlsMode), deliveryResult).Observe(float64(time.Since(start)) / float64(time.Second))
|
||||
log.Debug("queue deliverhost result", mlog.Field("host", host), mlog.Field("attempt", m.Attempts), mlog.Field("tlsmode", tlsMode), mlog.Field("permanent", permanent), mlog.Field("badTLS", badTLS), mlog.Field("secodeOpt", secodeOpt), mlog.Field("errmsg", errmsg), mlog.Field("ok", ok), mlog.Field("duration", time.Since(start)))
|
||||
log.Debug("queue deliverhost result", mlog.Field("host", host), mlog.Field("attempt", m.Attempts), mlog.Field("tlsmode", tlsMode), mlog.Field("permanent", permanent), mlog.Field("badtls", badTLS), mlog.Field("secodeopt", secodeOpt), mlog.Field("errmsg", errmsg), mlog.Field("ok", ok), mlog.Field("duration", time.Since(start)))
|
||||
}()
|
||||
|
||||
f, err := os.Open(m.MessagePath())
|
||||
|
|
|
@ -271,7 +271,7 @@ func analyze(ctx context.Context, log *mlog.Log, resolver dns.Resolver, d delive
|
|||
}
|
||||
accept = contentProb <= threshold
|
||||
junkSubjectpass = contentProb < threshold-0.2
|
||||
log.Info("content analyzed", mlog.Field("accept", accept), mlog.Field("contentProb", contentProb), mlog.Field("subjectpass", junkSubjectpass))
|
||||
log.Info("content analyzed", mlog.Field("accept", accept), mlog.Field("contentprob", contentProb), mlog.Field("subjectpass", junkSubjectpass))
|
||||
} else if err != store.ErrNoJunkFilter {
|
||||
log.Errorx("open junkfilter", err)
|
||||
return reject(smtp.C451LocalErr, smtp.SeSys3Other0, "error processing", err, reasonJunkFilterError)
|
||||
|
|
|
@ -1874,7 +1874,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
|
|||
})
|
||||
switch receivedSPF.Result {
|
||||
case spf.StatusPass:
|
||||
c.log.Debug("spf pass", mlog.Field("ip", spfArgs.RemoteIP), mlog.Field("mailfromDomain", spfArgs.MailFromDomain.ASCII)) // todo: log the domain that was actually verified.
|
||||
c.log.Debug("spf pass", mlog.Field("ip", spfArgs.RemoteIP), mlog.Field("mailfromdomain", spfArgs.MailFromDomain.ASCII)) // todo: log the domain that was actually verified.
|
||||
case spf.StatusFail:
|
||||
if spfExpl != "" {
|
||||
// Filter out potentially hostile text. ../rfc/7208:2529
|
||||
|
@ -2237,7 +2237,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
|
|||
conf, _ := acc.Conf()
|
||||
if conf.RejectsMailbox != "" && messageID != "" {
|
||||
if err := acc.RejectsRemove(log, conf.RejectsMailbox, messageID); err != nil {
|
||||
log.Errorx("removing message from rejects mailbox", err, mlog.Field("messageID", messageID))
|
||||
log.Errorx("removing message from rejects mailbox", err, mlog.Field("messageid", messageID))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -291,7 +291,7 @@ func evaluate(ctx context.Context, record *Record, resolver dns.Resolver, args A
|
|||
log := xlog.WithContext(ctx)
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
log.Debugx("spf evaluate result", rerr, mlog.Field("dnsrequests", *args.dnsRequests), mlog.Field("voidLookups", *args.voidLookups), mlog.Field("domain", args.domain), mlog.Field("status", rstatus), mlog.Field("mechanism", mechanism), mlog.Field("explanation", rexplanation), mlog.Field("duration", time.Since(start)))
|
||||
log.Debugx("spf evaluate result", rerr, mlog.Field("dnsrequests", *args.dnsRequests), mlog.Field("voidlookups", *args.voidLookups), mlog.Field("domain", args.domain), mlog.Field("status", rstatus), mlog.Field("mechanism", mechanism), mlog.Field("explanation", rexplanation), mlog.Field("duration", time.Since(start)))
|
||||
}()
|
||||
|
||||
resolver = dns.WithPackage(resolver, "spf")
|
||||
|
|
|
@ -92,7 +92,7 @@ func (a *Account) RetrainMessage(log *mlog.Log, tx *bstore.Tx, jf *junk.Filter,
|
|||
return nil
|
||||
}
|
||||
|
||||
log.Debug("updating junk filter", mlog.Field("untrain", untrain), mlog.Field("untrainJunk", untrainJunk), mlog.Field("train", train), mlog.Field("trainJunk", trainJunk))
|
||||
log.Debug("updating junk filter", mlog.Field("untrain", untrain), mlog.Field("untrainjunk", untrainJunk), mlog.Field("train", train), mlog.Field("trainjunk", trainJunk))
|
||||
|
||||
mr := a.MessageReader(*m)
|
||||
defer func() {
|
||||
|
|
|
@ -185,7 +185,7 @@ func Check(ctx context.Context, resolver dns.Resolver, domain dns.Domain, lastKn
|
|||
log := xlog.WithContext(ctx)
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
log.Debugx("updates check result", rerr, mlog.Field("domain", domain), mlog.Field("lastKnown", lastKnown), mlog.Field("changelogbaseurl", changelogBaseURL), mlog.Field("version", rversion), mlog.Field("record", rrecord), mlog.Field("duration", time.Since(start)))
|
||||
log.Debugx("updates check result", rerr, mlog.Field("domain", domain), mlog.Field("lastknown", lastKnown), mlog.Field("changelogbaseurl", changelogBaseURL), mlog.Field("version", rversion), mlog.Field("record", rrecord), mlog.Field("duration", time.Since(start)))
|
||||
}()
|
||||
|
||||
latest, record, err := Lookup(ctx, resolver, domain)
|
||||
|
|
Loading…
Reference in a new issue