aboutsummaryrefslogtreecommitdiffstats
path: root/worker/mbox/worker.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-06-04 21:57:56 +0200
committerRobin Jarry <robin@jarry.cc>2023-06-12 11:23:13 +0200
commit1bd6612c78dc00fd04ef5d614d729e3c0ece7ac8 (patch)
tree79ef8742592b2289adf0404de042f5e93b2d8d2a /worker/mbox/worker.go
parent2c751a27a3c144274bf4091eb13b1eeee89e6230 (diff)
downloadaerc-1bd6612c78dc00fd04ef5d614d729e3c0ece7ac8.tar.gz
mbox: use named logger
Use the worker's logging functions to have all mbox 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/mbox/worker.go')
-rw-r--r--worker/mbox/worker.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go
index 7a746cf0..0e6c64d1 100644
--- a/worker/mbox/worker.go
+++ b/worker/mbox/worker.go
@@ -80,7 +80,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
reterr = err
break
} else {
- log.Debugf("configured with mbox file %s", dir)
+ w.worker.Debugf("configured with mbox file %s", dir)
}
case *types.Connect, *types.Reconnect, *types.Disconnect:
@@ -116,7 +116,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
Info: w.data.DirectoryInfo(msg.Directory),
}, nil)
w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
- log.Debugf("%s opened", msg.Directory)
+ w.worker.Debugf("%s opened", msg.Directory)
case *types.FetchDirectoryContents:
uids, err := filterUids(w.folder, w.folder.Uids(), msg.FilterCriteria)
@@ -183,7 +183,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
case *types.FetchMessageBodyPart:
m, err := w.folder.Message(msg.Uid)
if err != nil {
- log.Errorf("could not get message %d: %v", msg.Uid, err)
+ w.worker.Errorf("could not get message %d: %v", msg.Uid, err)
reterr = err
break
}
@@ -202,7 +202,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
r, err := lib.FetchEntityPartReader(fullMsg, msg.Part)
if err != nil {
- log.Errorf(
+ w.worker.Errorf(
"could not get body part reader for message=%d, parts=%#v: %w",
msg.Uid, msg.Part, err)
reterr = err
@@ -221,18 +221,18 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
for _, uid := range msg.Uids {
m, err := w.folder.Message(uid)
if err != nil {
- log.Errorf("could not get message for uid %d: %v", uid, err)
+ w.worker.Errorf("could not get message for uid %d: %v", uid, err)
continue
}
r, err := m.NewReader()
if err != nil {
- log.Errorf("could not get message reader: %v", err)
+ w.worker.Errorf("could not get message reader: %v", err)
continue
}
defer r.Close()
b, err := io.ReadAll(r)
if err != nil {
- log.Errorf("could not get message reader: %v", err)
+ w.worker.Errorf("could not get message reader: %v", err)
continue
}
w.worker.PostMessage(&types.FullMessage{
@@ -267,17 +267,17 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
for _, uid := range msg.Uids {
m, err := w.folder.Message(uid)
if err != nil {
- log.Errorf("could not get message: %v", err)
+ w.worker.Errorf("could not get message: %v", err)
continue
}
if err := m.(*message).SetFlag(msg.Flags, msg.Enable); err != nil {
- log.Errorf("could not change flag %v to %t on message: %v",
+ w.worker.Errorf("could not change flag %v to %t on message: %v",
msg.Flags, msg.Enable, err)
continue
}
info, err := lib.MessageInfo(m)
if err != nil {
- log.Errorf("could not get message info: %v", err)
+ w.worker.Errorf("could not get message info: %v", err)
continue
}