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/flags.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/flags.go')
-rw-r--r-- | worker/imap/flags.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/worker/imap/flags.go b/worker/imap/flags.go index 2bded2ae..5b2ac410 100644 --- a/worker/imap/flags.go +++ b/worker/imap/flags.go @@ -28,7 +28,7 @@ func (imapw *IMAPWorker) handleDeleteMessages(msg *types.DeleteMessages) { for seqNum := range ch { if uid, found := imapw.seqMap.Pop(seqNum); !found { - imapw.worker.Logger.Printf("handleDeleteMessages unknown seqnum: %v", seqNum) + logging.Errorf("handleDeleteMessages unknown seqnum: %d", seqNum) } else { deleted = append(deleted, uid) } @@ -73,8 +73,8 @@ func (imapw *IMAPWorker) handleAnsweredMessages(msg *types.AnsweredMessages) { }, func(_msg types.WorkerMessage) { switch m := _msg.(type) { case *types.Error: - err := fmt.Errorf("handleAnsweredMessages: %v", m.Error) - imapw.worker.Logger.Printf("could not fetch headers: %s", err) + err := fmt.Errorf("handleAnsweredMessages: %w", m.Error) + logging.Errorf("could not fetch headers: %v", err) emitErr(err) case *types.Done: imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) @@ -104,8 +104,8 @@ func (imapw *IMAPWorker) handleFlagMessages(msg *types.FlagMessages) { }, func(_msg types.WorkerMessage) { switch m := _msg.(type) { case *types.Error: - err := fmt.Errorf("handleFlagMessages: %v", m.Error) - imapw.worker.Logger.Printf("could not fetch headers: %s", err) + err := fmt.Errorf("handleFlagMessages: %w", m.Error) + logging.Errorf("could not fetch headers: %v", err) emitErr(err) case *types.Done: imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) |