aerc/worker/notmuch/eventhandlers.go
Robin Jarry cd19995557 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>
2022-07-23 22:52:15 +02:00

28 lines
576 B
Go

//go:build notmuch
// +build notmuch
package notmuch
import "git.sr.ht/~rjarry/aerc/logging"
func (w *worker) handleNotmuchEvent(et eventType) error {
switch ev := et.(type) {
case *updateDirCounts:
return w.handleUpdateDirCounts(ev)
default:
return errUnsupported
}
}
func (w *worker) handleUpdateDirCounts(ev eventType) error {
for name, query := range w.nameQueryMap {
info, err := w.gatherDirectoryInfo(name, query)
if err != nil {
logging.Errorf("could not gather DirectoryInfo: %v", err)
continue
}
w.w.PostMessage(info, nil)
}
return nil
}