diff options
author | Robin Jarry <robin@jarry.cc> | 2022-07-19 22:31:51 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-07-23 22:52:15 +0200 |
commit | cd1999555714fb886493d2d04b6c472be55cebef (patch) | |
tree | 1df3bcf5f687752db671d8bc9c7eab8a5c0fde71 /worker/imap/fetch.go | |
parent | a1f779ccc9b16b22ad6cb2e0bf73c290fd0cc756 (diff) | |
download | aerc-cd1999555714fb886493d2d04b6c472be55cebef.tar.gz |
logging: use level-based logger functions
Do not pass logger objects around anymore. Shuffle some messages to make
them consistent with the new logging API. Avoid using %v when a more
specific verb exists for the argument types.
The loggers are completely disabled (i.e. Sprintf is not even called)
by default. They are only enabled when redirecting stdout to a file.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'worker/imap/fetch.go')
-rw-r--r-- | worker/imap/fetch.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go index cf27e382..6ef0baca 100644 --- a/worker/imap/fetch.go +++ b/worker/imap/fetch.go @@ -26,7 +26,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( nil) return } - imapw.worker.Logger.Printf("Fetching message headers") + logging.Infof("Fetching message headers: %v", toFetch) section := &imap.BodySectionName{ BodyPartName: imap.BodyPartName{ Specifier: imap.HeaderSpecifier, @@ -47,8 +47,8 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( reader := _msg.GetBody(section) textprotoHeader, err := textproto.ReadHeader(bufio.NewReader(reader)) if err != nil { - imapw.worker.Logger.Printf( - "message %v: could not read header: %v", _msg.Uid, err) + logging.Errorf( + "message %d: could not read header: %v", _msg.Uid, err) imapw.worker.PostMessage(&types.Error{ Message: types.RespondTo(msg), Error: err, @@ -78,7 +78,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( func (imapw *IMAPWorker) handleFetchMessageBodyPart( msg *types.FetchMessageBodyPart) { - imapw.worker.Logger.Printf("Fetching message part") + logging.Infof("Fetching message %d part: %v", msg.Uid, msg.Part) var partHeaderSection imap.BodySectionName partHeaderSection.Peek = true @@ -148,7 +148,7 @@ func (imapw *IMAPWorker) handleFetchMessageBodyPart( func (imapw *IMAPWorker) handleFetchFullMessages( msg *types.FetchFullMessages) { - imapw.worker.Logger.Printf("Fetching full messages") + logging.Infof("Fetching full messages: %v", msg.Uids) section := &imap.BodySectionName{} items := []imap.FetchItem{ imap.FetchEnvelope, |