diff options
author | Robin Jarry <robin@jarry.cc> | 2023-06-04 21:52:51 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-06-12 11:23:08 +0200 |
commit | 13e356c4a4a296edea4245fb8850aeba49ae1851 (patch) | |
tree | 4bef7eef06ea554b82c16cace41eb9b9c5109459 /worker/imap/worker.go | |
parent | 68e1809b3c602f2119505df78eea3d1d93854f83 (diff) | |
download | aerc-13e356c4a4a296edea4245fb8850aeba49ae1851.tar.gz |
imap: use named logger
Use the worker's logging functions to have all imap related messages
prefixed by the account name.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'worker/imap/worker.go')
-rw-r--r-- | worker/imap/worker.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/worker/imap/worker.go b/worker/imap/worker.go index f46f39d6..dc1891ca 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -12,7 +12,6 @@ import ( "github.com/syndtr/goleveldb/leveldb" "git.sr.ht/~rjarry/aerc/lib" - "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/handlers" "git.sr.ht/~rjarry/aerc/worker/imap/extensions" @@ -104,21 +103,21 @@ func (w *IMAPWorker) newClient(c *client.Client) { sort, err := w.client.sort.SupportSort() if err == nil && sort { w.caps.Sort = true - log.Debugf("Server Capability found: Sort") + w.worker.Debugf("Server Capability found: Sort") } for _, alg := range []sortthread.ThreadAlgorithm{sortthread.References, sortthread.OrderedSubject} { ok, err := w.client.Support(fmt.Sprintf("THREAD=%s", string(alg))) if err == nil && ok { w.threadAlgorithm = alg w.caps.Thread = true - log.Debugf("Server Capability found: Thread (algorithm: %s)", string(alg)) + w.worker.Debugf("Server Capability found: Thread (algorithm: %s)", string(alg)) break } } lStatus, err := w.client.liststatus.SupportListStatus() if err == nil && lStatus { w.liststatus = true - log.Debugf("Server Capability found: LIST-STATUS") + w.worker.Debugf("Server Capability found: LIST-STATUS") } } @@ -249,7 +248,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { } func (w *IMAPWorker) handleImapUpdate(update client.Update) { - log.Tracef("(= %T", update) + w.worker.Tracef("(= %T", update) switch update := update.(type) { case *client.MailboxUpdate: w.worker.PostAction(&types.CheckMail{ @@ -259,7 +258,7 @@ func (w *IMAPWorker) handleImapUpdate(update client.Update) { msg := update.Message if msg.Uid == 0 { if uid, found := w.seqMap.Get(msg.SeqNum); !found { - log.Errorf("MessageUpdate unknown seqnum: %d", msg.SeqNum) + w.worker.Errorf("MessageUpdate unknown seqnum: %d", msg.SeqNum) return } else { msg.Uid = uid @@ -279,7 +278,7 @@ func (w *IMAPWorker) handleImapUpdate(update client.Update) { }, nil) case *client.ExpungeUpdate: if uid, found := w.seqMap.Pop(update.SeqNum); !found { - log.Errorf("ExpungeUpdate unknown seqnum: %d", update.SeqNum) + w.worker.Errorf("ExpungeUpdate unknown seqnum: %d", update.SeqNum) } else { w.worker.PostMessage(&types.MessagesDeleted{ Uids: []uint32{uid}, |