diff options
Diffstat (limited to 'worker')
-rw-r--r-- | worker/imap/cache.go | 30 | ||||
-rw-r--r-- | worker/imap/checkmail.go | 4 | ||||
-rw-r--r-- | worker/imap/connect.go | 8 | ||||
-rw-r--r-- | worker/imap/fetch.go | 12 | ||||
-rw-r--r-- | worker/imap/flags.go | 4 | ||||
-rw-r--r-- | worker/imap/idler.go | 8 | ||||
-rw-r--r-- | worker/imap/list.go | 8 | ||||
-rw-r--r-- | worker/imap/observer.go | 4 | ||||
-rw-r--r-- | worker/imap/open.go | 16 | ||||
-rw-r--r-- | worker/imap/worker.go | 12 | ||||
-rw-r--r-- | worker/lib/parse.go | 4 | ||||
-rw-r--r-- | worker/maildir/search.go | 6 | ||||
-rw-r--r-- | worker/maildir/worker.go | 76 | ||||
-rw-r--r-- | worker/mbox/worker.go | 30 | ||||
-rw-r--r-- | worker/notmuch/eventhandlers.go | 4 | ||||
-rw-r--r-- | worker/notmuch/lib/database.go | 16 | ||||
-rw-r--r-- | worker/notmuch/worker.go | 72 | ||||
-rw-r--r-- | worker/types/thread.go | 4 | ||||
-rw-r--r-- | worker/types/worker.go | 18 |
19 files changed, 168 insertions, 168 deletions
diff --git a/worker/imap/cache.go b/worker/imap/cache.go index cf92dfaa..a889f725 100644 --- a/worker/imap/cache.go +++ b/worker/imap/cache.go @@ -9,7 +9,7 @@ import ( "path" "time" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" "github.com/emersion/go-message" @@ -34,18 +34,18 @@ func (w *IMAPWorker) initCacheDb(acct string) { cd, err := cacheDir() if err != nil { w.cache = nil - logging.Errorf("unable to find cache directory: %v", err) + log.Errorf("unable to find cache directory: %v", err) return } p := path.Join(cd, acct) db, err := leveldb.OpenFile(p, nil) if err != nil { w.cache = nil - logging.Errorf("failed opening cache db: %v", err) + log.Errorf("failed opening cache db: %v", err) return } w.cache = db - logging.Debugf("cache db opened: %s", p) + log.Debugf("cache db opened: %s", p) if w.config.cacheMaxAge.Hours() > 0 { go w.cleanCache(p) } @@ -54,11 +54,11 @@ func (w *IMAPWorker) initCacheDb(acct string) { func (w *IMAPWorker) cacheHeader(mi *models.MessageInfo) { uv := fmt.Sprintf("%d", w.selected.UidValidity) uid := fmt.Sprintf("%d", mi.Uid) - logging.Debugf("caching header for message %s.%s", uv, uid) + log.Debugf("caching header for message %s.%s", uv, uid) hdr := bytes.NewBuffer(nil) err := textproto.WriteHeader(hdr, mi.RFC822Headers.Header.Header) if err != nil { - logging.Errorf("cannot write header %s.%s: %v", uv, uid, err) + log.Errorf("cannot write header %s.%s: %v", uv, uid, err) return } h := &CachedHeader{ @@ -73,18 +73,18 @@ func (w *IMAPWorker) cacheHeader(mi *models.MessageInfo) { enc := gob.NewEncoder(data) err = enc.Encode(h) if err != nil { - logging.Errorf("cannot encode message %s.%s: %v", uv, uid, err) + log.Errorf("cannot encode message %s.%s: %v", uv, uid, err) return } err = w.cache.Put([]byte("header."+uv+"."+uid), data.Bytes(), nil) if err != nil { - logging.Errorf("cannot write header for message %s.%s: %v", uv, uid, err) + log.Errorf("cannot write header for message %s.%s: %v", uv, uid, err) return } } func (w *IMAPWorker) getCachedHeaders(msg *types.FetchMessageHeaders) []uint32 { - logging.Tracef("Retrieving headers from cache: %v", msg.Uids) + log.Tracef("Retrieving headers from cache: %v", msg.Uids) var need []uint32 uv := fmt.Sprintf("%d", w.selected.UidValidity) for _, uid := range msg.Uids { @@ -98,14 +98,14 @@ func (w *IMAPWorker) getCachedHeaders(msg *types.FetchMessageHeaders) []uint32 { dec := gob.NewDecoder(bytes.NewReader(data)) err = dec.Decode(ch) if err != nil { - logging.Errorf("cannot decode cached header %s.%s: %v", uv, u, err) + log.Errorf("cannot decode cached header %s.%s: %v", uv, u, err) need = append(need, uid) continue } hr := bytes.NewReader(ch.Header) textprotoHeader, err := textproto.ReadHeader(bufio.NewReader(hr)) if err != nil { - logging.Errorf("cannot read cached header %s.%s: %v", uv, u, err) + log.Errorf("cannot read cached header %s.%s: %v", uv, u, err) need = append(need, uid) continue } @@ -122,7 +122,7 @@ func (w *IMAPWorker) getCachedHeaders(msg *types.FetchMessageHeaders) []uint32 { if err != nil { mi.Refs = refs } - logging.Tracef("located cached header %s.%s", uv, u) + log.Tracef("located cached header %s.%s", uv, u) w.worker.PostMessage(&types.MessageInfo{ Message: types.RespondTo(msg), Info: mi, @@ -154,14 +154,14 @@ func (w *IMAPWorker) cleanCache(path string) { dec := gob.NewDecoder(bytes.NewReader(data)) err := dec.Decode(ch) if err != nil { - logging.Errorf("cannot clean database %d: %v", w.selected.UidValidity, err) + log.Errorf("cannot clean database %d: %v", w.selected.UidValidity, err) continue } exp := ch.Created.Add(w.config.cacheMaxAge) if exp.Before(time.Now()) { err = w.cache.Delete(iter.Key(), nil) if err != nil { - logging.Errorf("cannot clean database %d: %v", w.selected.UidValidity, err) + log.Errorf("cannot clean database %d: %v", w.selected.UidValidity, err) continue } removed++ @@ -170,6 +170,6 @@ func (w *IMAPWorker) cleanCache(path string) { } iter.Release() elapsed := time.Since(start) - logging.Debugf("%s: removed %d/%d expired entries in %s", + log.Debugf("%s: removed %d/%d expired entries in %s", path, removed, scanned, elapsed) } diff --git a/worker/imap/checkmail.go b/worker/imap/checkmail.go index 0f347e09..34cf63d1 100644 --- a/worker/imap/checkmail.go +++ b/worker/imap/checkmail.go @@ -1,7 +1,7 @@ package imap import ( - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" "github.com/emersion/go-imap" @@ -20,7 +20,7 @@ func (w *IMAPWorker) handleCheckMailMessage(msg *types.CheckMail) { continue } - logging.Tracef("Getting status of directory %s", dir) + log.Tracef("Getting status of directory %s", dir) status, err := w.client.Status(dir, items) if err != nil { w.worker.PostMessage(&types.Error{ diff --git a/worker/imap/connect.go b/worker/imap/connect.go index 035feaba..d6c946db 100644 --- a/worker/imap/connect.go +++ b/worker/imap/connect.go @@ -7,7 +7,7 @@ import ( "time" "git.sr.ht/~rjarry/aerc/lib" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "github.com/emersion/go-imap" "github.com/emersion/go-imap/client" ) @@ -66,7 +66,7 @@ func (w *IMAPWorker) connect() (*client.Client, error) { return nil, fmt.Errorf("Unknown IMAP scheme %s", w.config.scheme) } - c.ErrorLog = logging.ErrorLogger() + c.ErrorLog = log.ErrorLogger() if w.config.user != nil { username := w.config.user.Username() @@ -165,12 +165,12 @@ func (w *IMAPWorker) setKeepaliveParameters(conn *net.TCPConn) error { // Max number of probes before failure err := lib.SetTcpKeepaliveProbes(fd, w.config.keepalive_probes) if err != nil { - logging.Errorf("cannot set tcp keepalive probes: %v", err) + log.Errorf("cannot set tcp keepalive probes: %v", err) } // Wait time after an unsuccessful probe err = lib.SetTcpKeepaliveInterval(fd, w.config.keepalive_interval) if err != nil { - logging.Errorf("cannot set tcp keepalive interval: %v", err) + log.Errorf("cannot set tcp keepalive interval: %v", err) } }) return err diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go index 9256c6eb..62451308 100644 --- a/worker/imap/fetch.go +++ b/worker/imap/fetch.go @@ -10,7 +10,7 @@ import ( "github.com/emersion/go-message/mail" "github.com/emersion/go-message/textproto" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -27,7 +27,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( nil) return } - logging.Tracef("Fetching message headers: %v", toFetch) + log.Tracef("Fetching message headers: %v", toFetch) section := &imap.BodySectionName{ BodyPartName: imap.BodyPartName{ Specifier: imap.HeaderSpecifier, @@ -84,7 +84,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( func (imapw *IMAPWorker) handleFetchMessageBodyPart( msg *types.FetchMessageBodyPart, ) { - logging.Tracef("Fetching message %d part: %v", msg.Uid, msg.Part) + log.Tracef("Fetching message %d part: %v", msg.Uid, msg.Part) var partHeaderSection imap.BodySectionName partHeaderSection.Peek = true @@ -130,7 +130,7 @@ func (imapw *IMAPWorker) handleFetchMessageBodyPart( part, err := message.New(message.Header{Header: h}, _msg.GetBody(&partBodySection)) if message.IsUnknownCharset(err) { - logging.Warnf("unknown charset encountered "+ + log.Warnf("unknown charset encountered "+ "for uid %d", _msg.Uid) } else if err != nil { return fmt.Errorf("failed to create message reader: %w", err) @@ -158,7 +158,7 @@ func (imapw *IMAPWorker) handleFetchMessageBodyPart( func (imapw *IMAPWorker) handleFetchFullMessages( msg *types.FetchFullMessages, ) { - logging.Tracef("Fetching full messages: %v", msg.Uids) + log.Tracef("Fetching full messages: %v", msg.Uids) section := &imap.BodySectionName{ Peek: true, } @@ -223,7 +223,7 @@ func (imapw *IMAPWorker) handleFetchMessages( done := make(chan error) go func() { - defer logging.PanicHandler() + defer log.PanicHandler() var reterr error for _msg := range messages { diff --git a/worker/imap/flags.go b/worker/imap/flags.go index 7ff6de37..9d9ecc86 100644 --- a/worker/imap/flags.go +++ b/worker/imap/flags.go @@ -3,7 +3,7 @@ package imap import ( "github.com/emersion/go-imap" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -76,7 +76,7 @@ func (imapw *IMAPWorker) handleStoreOps( done := make(chan error) go func() { - defer logging.PanicHandler() + defer log.PanicHandler() var reterr error for _msg := range messages { diff --git a/worker/imap/idler.go b/worker/imap/idler.go index da018334..d099ee88 100644 --- a/worker/imap/idler.go +++ b/worker/imap/idler.go @@ -5,7 +5,7 @@ import ( "sync" "time" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/worker/types" "github.com/emersion/go-imap" "github.com/emersion/go-imap/client" @@ -78,7 +78,7 @@ func (i *idler) Start() { i.stop = make(chan struct{}) go func() { - defer logging.PanicHandler() + defer log.PanicHandler() select { case <-i.stop: // debounce idle @@ -146,7 +146,7 @@ func (i *idler) waitOnIdle() { i.setWaiting(true) i.log("wait for idle in background") go func() { - defer logging.PanicHandler() + defer log.PanicHandler() err := <-i.done if err == nil { i.log("<=(idle) waited") @@ -166,5 +166,5 @@ func (i *idler) waitOnIdle() { func (i *idler) log(format string, v ...interface{}) { msg := fmt.Sprintf(format, v...) - logging.Tracef("idler (%p) [idle:%t,wait:%t] %s", i, i.isIdleing(), i.isWaiting(), msg) + log.Tracef("idler (%p) [idle:%t,wait:%t] %s", i, i.isIdleing(), i.isWaiting(), msg) } diff --git a/worker/imap/list.go b/worker/imap/list.go index c3211f21..e02d7cbb 100644 --- a/worker/imap/list.go +++ b/worker/imap/list.go @@ -3,18 +3,18 @@ package imap import ( "github.com/emersion/go-imap" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" ) func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) { mailboxes := make(chan *imap.MailboxInfo) - logging.Tracef("Listing mailboxes") + log.Tracef("Listing mailboxes") done := make(chan interface{}) go func() { - defer logging.PanicHandler() + defer log.PanicHandler() for mbox := range mailboxes { if !canOpen(mbox) { @@ -62,7 +62,7 @@ func (imapw *IMAPWorker) handleSearchDirectory(msg *types.SearchDirectory) { }, nil) } - logging.Tracef("Executing search") + log.Tracef("Executing search") criteria, err := parseSearch(msg.Argv) if err != nil { emitError(err) diff --git a/worker/imap/observer.go b/worker/imap/observer.go index 867b57d9..2cfe8bd9 100644 --- a/worker/imap/observer.go +++ b/worker/imap/observer.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/worker/types" "github.com/emersion/go-imap" ) @@ -150,5 +150,5 @@ func (o *observer) emit(errMsg string) { func (o *observer) log(format string, args ...interface{}) { msg := fmt.Sprintf(format, args...) - logging.Tracef("observer (%p) [running:%t] %s", o, o.running, msg) + log.Tracef("observer (%p) [running:%t] %s", o, o.running, msg) } diff --git a/worker/imap/open.go b/worker/imap/open.go index f554d524..ced307be 100644 --- a/worker/imap/open.go +++ b/worker/imap/open.go @@ -5,12 +5,12 @@ import ( sortthread "github.com/emersion/go-imap-sortthread" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/worker/types" ) func (imapw *IMAPWorker) handleOpenDirectory(msg *types.OpenDirectory) { - logging.Debugf("Opening %s", msg.Directory) + log.Debugf("Opening %s", msg.Directory) sel, err := imapw.client.Select(msg.Directory, false) if err != nil { @@ -27,7 +27,7 @@ func (imapw *IMAPWorker) handleOpenDirectory(msg *types.OpenDirectory) { func (imapw *IMAPWorker) handleFetchDirectoryContents( msg *types.FetchDirectoryContents, ) { - logging.Tracef("Fetching UID list") + log.Tracef("Fetching UID list") searchCriteria, err := parseSearch(msg.FilterCriteria) if err != nil { @@ -52,9 +52,9 @@ func (imapw *IMAPWorker) handleFetchDirectoryContents( } else { if err != nil { // Non fatal, but we do want to print to get some debug info - logging.Errorf("can't check for SORT support: %v", err) + log.Errorf("can't check for SORT support: %v", err) } else if len(sortCriteria) > 0 { - logging.Warnf("SORT is not supported but requested: list messages by UID") + log.Warnf("SORT is not supported but requested: list messages by UID") } uids, err = imapw.client.UidSearch(searchCriteria) } @@ -64,7 +64,7 @@ func (imapw *IMAPWorker) handleFetchDirectoryContents( Error: err, }, nil) } else { - logging.Tracef("Found %d UIDs", len(uids)) + log.Tracef("Found %d UIDs", len(uids)) if len(msg.FilterCriteria) == 1 { // Only initialize if we are not filtering imapw.seqMap.Initialize(uids) @@ -105,7 +105,7 @@ func translateSortCriterions( func (imapw *IMAPWorker) handleDirectoryThreaded( msg *types.FetchDirectoryThreaded, ) { - logging.Tracef("Fetching threaded UID list") + log.Tracef("Fetching threaded UID list") searchCriteria, err := parseSearch(msg.FilterCriteria) if err != nil { @@ -125,7 +125,7 @@ func (imapw *IMAPWorker) handleDirectoryThreaded( } else { aercThreads, count := convertThreads(threads, nil) sort.Sort(types.ByUID(aercThreads)) - logging.Tracef("Found %d threaded messages", count) + log.Tracef("Found %d threaded messages", count) if len(msg.FilterCriteria) == 1 { // Only initialize if we are not filtering var uids []uint32 diff --git a/worker/imap/worker.go b/worker/imap/worker.go index c3021f91..32e05859 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -12,7 +12,7 @@ import ( "github.com/syndtr/goleveldb/leveldb" "git.sr.ht/~rjarry/aerc/lib" - "git.sr.ht/~rjarry/aerc/logging" + "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/types" @@ -93,14 +93,14 @@ func (w *IMAPWorker) newClient(c *client.Client) { sort, err := w.client.sort.SupportSort() if err == nil && sort { w.caps.Sort = true - logging.Debugf("Server Capability found: Sort") + log.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 - logging.Debugf("Server Capability found: Thread (algorithm: %s)", string(alg)) + log.Debugf("Server Capability found: Thread (algorithm: %s)", string(alg)) break } } @@ -233,7 +233,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { } func (w *IMAPWorker) handleImapUpdate(update client.Update) { - logging.Tracef("(= %T", update) + log.Tracef("(= %T", update) switch update := update.(type) { case *client.MailboxUpdate: status := update.Mailbox @@ -256,7 +256,7 @@ func (w *IMAPWorker) handleImapUpdate(update client.Update) { msg := update.Message if msg.Uid == 0 { if uid, found := w.seqMap.Get(msg.SeqNum); !found { - logging.Errorf("MessageUpdate unknown seqnum: %d", msg.SeqNum) + log.Errorf("MessageUpdate unknown seqnum: %d", msg.SeqNum) return } else { msg.Uid = uid @@ -276,7 +276,7 @@ func (w *IMAPWorker) handleImapUpdate(update client.Update) { }, nil) case *client.ExpungeUpdate: if uid, found := w.seqMap.Pop(update.SeqNum); !found { - logging.Errorf("ExpungeUpdate unknown seqnum: %d", update.SeqNum) + log.Errorf("ExpungeUpdate unknown seqnum: %d", update.SeqNum) } else { w.worker.PostMessage(&types.MessagesDeleted{ Uids: []uint32{uid}, diff --git a/worker/lib/parse.go b/worker/lib/parse.go index 8c1be2a9..67955c8f 100644 --- a/worker/lib/parse.go +++ b/worker/lib/parse.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "github.com/emersion/go-message" _ "github.com/emersion/go-message/charset" @@ -384,7 +384,7 @@ func NewCRLFReader(r io.Reader) io.Reader { func ReadMessage(r io.Reader) (*message.Entity, error) { entity, err := message.Read(r) if message.IsUnknownCharset(err) { - logging.Warnf("unknown charset encountered") + log.Warnf("unknown charset encountered") } else if err != nil { return nil, fmt.Errorf("could not read message: %w", err) } diff --git a/worker/maildir/search.go b/worker/maildir/search.go index 0f3f6a42..3a78937d 100644 --- a/worker/maildir/search.go +++ b/worker/maildir/search.go @@ -13,7 +13,7 @@ import ( "git.sr.ht/~sircmpwn/getopt" "git.sr.ht/~rjarry/aerc/lib" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" ) @@ -91,7 +91,7 @@ func getParsedFlag(name string) maildir.Flag { func (w *Worker) search(criteria *searchCriteria) ([]uint32, error) { requiredParts := getRequiredParts(criteria) - logging.Debugf("Required parts bitmask for search: %b", requiredParts) + log.Debugf("Required parts bitmask for search: %b", requiredParts) keys, err := w.c.UIDs(*w.selected) if err != nil { @@ -112,7 +112,7 @@ func (w *Worker) search(criteria *searchCriteria) ([]uint32, error) { success, err := w.searchKey(key, criteria, requiredParts) if err != nil { // don't return early so that we can still get some results - logging.Errorf("Failed to search key %d: %v", key, err) + log.Errorf("Failed to search key %d: %v", key, err) } else if success { mu.Lock() matchedUids = append(matchedUids, key) diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index 2a8a49bd..45eca1d4 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -20,7 +20,7 @@ import ( aercLib "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/iterator" - "git.sr.ht/~rjarry/aerc/logging" + "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/lib" @@ -115,7 +115,7 @@ func (w *Worker) handleFSEvent(ev fsnotify.Event) { } err := w.c.SyncNewMail(*w.selected) if err != nil { - logging.Errorf("could not move new to cur : %v", err) + log.Errorf("could not move new to cur : %v", err) return } @@ -194,18 +194,18 @@ func (w *Worker) getDirectoryInfo(name string) *models.DirectoryInfo { for _, v := range files { key, flags, err := splitMaildirFile(v) if err != nil { - logging.Errorf("%q: error parsing flags (%q): %v", v, key, err) + log.Errorf("%q: error parsing flags (%q): %v", v, key, err) continue } keyFlags[key] = flags } } else { - logging.Tracef("disabled flags cache: %q: %v", dir, err) + log.Tracef("disabled flags cache: %q: %v", dir, err) } uids, err := w.c.UIDs(dir) if err != nil { - logging.Errorf("could not get uids: %v", err) + log.Errorf("could not get uids: %v", err) return dirInfo } @@ -213,7 +213,7 @@ func (w *Worker) getDirectoryInfo(name string) *models.DirectoryInfo { for _, uid := range uids { message, err := w.c.Message(dir, uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) continue } var flags []maildir.Flag @@ -221,18 +221,18 @@ func (w *Worker) getDirectoryInfo(name string) *models.DirectoryInfo { ok := false flags, ok = keyFlags[message.key] if !ok { - logging.Tracef("message (key=%q uid=%d) not found in map cache", + log.Tracef("message (key=%q uid=%d) not found in map cache", message.key, message.uid) flags, err = message.Flags() if err != nil { - logging.Errorf("could not get flags: %v", err) + log.Errorf("could not get flags: %v", err) continue } } } else { flags, err = message.Flags() if err != nil { - logging.Errorf("could not get flags: %v", err) + log.Errorf("could not get flags: %v", err) continue } } @@ -301,7 +301,7 @@ func (w *Worker) handleMessage(msg types.WorkerMessage) error { func (w *Worker) handleConfigure(msg *types.Configure) error { u, err := url.Parse(msg.Config.Source) if err != nil { - logging.Errorf("error configuring maildir worker: %v", err) + log.Errorf("error configuring maildir worker: %v", err) return err } dir := u.Path @@ -317,11 +317,11 @@ func (w *Worker) handleConfigure(msg *types.Configure) error { } c, err := NewContainer(dir, w.maildirpp) if err != nil { - logging.Errorf("could not configure maildir: %s", dir) + log.Errorf("could not configure maildir: %s", dir) return err } w.c = c - logging.Debugf("configured base maildir: %s", dir) + log.Debugf("configured base maildir: %s", dir) return nil } @@ -338,7 +338,7 @@ func (w *Worker) handleListDirectories(msg *types.ListDirectories) error { } dirs, err := w.c.Store.FolderMap() if err != nil { - logging.Errorf("failed listing directories: %v", err) + log.Errorf("failed listing directories: %v", err) return err } for name := range dirs { @@ -358,7 +358,7 @@ func (w *Worker) handleListDirectories(msg *types.ListDirectories) error { } func (w *Worker) handleOpenDirectory(msg *types.OpenDirectory) error { - logging.Debugf("opening %s", msg.Directory) + log.Debugf("opening %s", msg.Directory) // open the directory dir, err := w.c.OpenDirectory(msg.Directory) @@ -422,13 +422,13 @@ func (w *Worker) handleFetchDirectoryContents( } else { uids, err = w.c.UIDs(*w.selected) if err != nil { - logging.Errorf("failed scanning uids: %v", err) + log.Errorf("failed scanning uids: %v", err) return err } } sortedUids, err := w.sort(uids, msg.SortCriteria) if err != nil { - logging.Errorf("failed sorting directory: %v", err) + log.Errorf("failed sorting directory: %v", err) return err } w.currentSortCriteria = msg.SortCriteria @@ -461,7 +461,7 @@ func (w *Worker) sort(uids []uint32, criteria []*types.SortCriterion) ([]uint32, defer wg.Done() info, err := w.msgHeadersFromUid(uid) if err != nil { - logging.Errorf("could not get message info: %v", err) + log.Errorf("could not get message info: %v", err) <-limit return } @@ -475,7 +475,7 @@ func (w *Worker) sort(uids []uint32, criteria []*types.SortCriterion) ([]uint32, wg.Wait() sortedUids, err := lib.Sort(msgInfos, criteria) if err != nil { - logging.Errorf("could not sort the messages: %v", err) + log.Errorf("could not sort the messages: %v", err) return nil, err } return sortedUids, nil @@ -500,13 +500,13 @@ func (w *Worker) handleFetchDirectoryThreaded( } else { uids, err = w.c.UIDs(*w.selected) if err != nil { - logging.Errorf("failed scanning uids: %v", err) + log.Errorf("failed scanning uids: %v", err) return err } } threads, err := w.threads(uids, msg.SortCriteria) if err != nil { - logging.Errorf("failed sorting directory: %v", err) + log.Errorf("failed sorting directory: %v", err) return err } w.currentSortCriteria = msg.SortCriteria @@ -531,7 +531,7 @@ func (w *Worker) threads(uids []uint32, criteria []*types.SortCriterion) ([]*typ defer wg.Done() info, err := w.msgHeadersFromUid(uid) if err != nil { - logging.Errorf("could not get message info: %v", err) + log.Errorf("could not get message info: %v", err) <-limit return } @@ -552,7 +552,7 @@ func (w *Worker) threads(uids []uint32, criteria []*types.SortCriterion) ([]*typ default: uids, err = lib.Sort(msgInfos, criteria) if err != nil { - logging.Errorf("could not sort the messages: %v", err) + log.Errorf("could not sort the messages: %v", err) return nil, err } } @@ -563,7 +563,7 @@ func (w *Worker) threads(uids []uint32, criteria []*types.SortCriterion) ([]*typ func (w *Worker) handleCreateDirectory(msg *types.CreateDirectory) error { dir := w.c.Store.Dir(msg.Directory) if err := dir.Init(); err != nil { - logging.Errorf("could not create directory %s: %v", + log.Errorf("could not create directory %s: %v", msg.Directory, err) return err } @@ -573,7 +573,7 @@ func (w *Worker) handleCreateDirectory(msg *types.CreateDirectory) error { func (w *Worker) handleRemoveDirectory(msg *types.RemoveDirectory) error { dir := w.c.Store.Dir(msg.Directory) if err := os.RemoveAll(string(dir)); err != nil { - logging.Errorf("could not remove directory %s: %v", + log.Errorf("could not remove directory %s: %v", msg.Directory, err) return err } @@ -586,7 +586,7 @@ func (w *Worker) handleFetchMessageHeaders( for _, uid := range msg.Uids { info, err := w.msgInfoFromUid(uid) if err != nil { - logging.Errorf("could not get message info: %v", err) + log.Errorf("could not get message info: %v", err) w.worker.PostMessageInfoError(msg, uid, err) continue } @@ -605,12 +605,12 @@ func (w *Worker) handleFetchMessageBodyPart( // get reader m, err := w.c.Message(*w.selected, msg.Uid) if err != nil { - logging.Errorf("could not get message %d: %v", msg.Uid, err) + log.Errorf("could not get message %d: %v", msg.Uid, err) return err } r, err := m.NewBodyPartReader(msg.Part) if err != nil { - logging.Errorf( + log.Errorf( "could not get body part reader for message=%d, parts=%#v: %w", msg.Uid, msg.Part, err) return err @@ -630,12 +630,12 @@ func (w *Worker) handleFetchFullMessages(msg *types.FetchFullMessages) error { for _, uid := range msg.Uids { m, err := w.c.Message(*w.selected, uid) if err != nil { - logging.Errorf("could not get message %d: %v", uid, err) + log.Errorf("could not get message %d: %v", uid, err) return err } r, err := m.NewReader() if err != nil { - logging.Errorf("could not get message reader: %v", err) + log.Errorf("could not get message reader: %v", err) return err } defer r.Close() @@ -666,7 +666,7 @@ func (w *Worker) handleDeleteMessages(msg *types.DeleteMessages) error { }, nil) } if err != nil { - logging.Errorf("failed removing messages: %v", err) + log.Errorf("failed removing messages: %v", err) return err } return nil @@ -676,18 +676,18 @@ func (w *Worker) handleAnsweredMessages(msg *types.AnsweredMessages) error { for _, uid := range msg.Uids { m, err := w.c.Message(*w.selected, uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) w.err(msg, err) continue } if err := m.MarkReplied(msg.Answered); err != nil { - logging.Errorf("could not mark message as answered: %v", err) + log.Errorf("could not mark message as answered: %v", err) w.err(msg, err) continue } info, err := m.MessageInfo() if err != nil { - logging.Errorf("could not get message info: %v", err) + log.Errorf("could not get message info: %v", err) w.err(msg, err) continue } @@ -708,19 +708,19 @@ func (w *Worker) handleFlagMessages(msg *types.FlagMessages) error { for _, uid := range msg.Uids { m, err := w.c.Message(*w.selected, uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) w.err(msg, err) continue } flag := lib.FlagToMaildir[msg.Flag] if err := m.SetOneFlag(flag, msg.Enable); err != nil { - logging.Errorf("could change flag %v to %v on message: %v", flag, msg.Enable, err) + log.Errorf("could change flag %v to %v on message: %v", flag, msg.Enable, err) w.err(msg, err) continue } info, err := m.MessageInfo() if err != nil { - logging.Errorf("could not get message info: %v", err) + log.Errorf("could not get message info: %v", err) w.err(msg, err) continue } @@ -786,12 +786,12 @@ func (w *Worker) handleAppendMessage(msg *types.AppendMessage) error { } func (w *Worker) handleSearchDirectory(msg *types.SearchDirectory) error { - logging.Debugf("Searching directory %v with args: %v", *w.selected, msg.Argv) + log.Debugf("Searching directory %v with args: %v", *w.selected, msg.Argv) criteria, err := parseSearch(msg.Argv) if err != nil { return err } - logging.Tracef("Searching with parsed criteria: %#v", criteria) + log.Tracef("Searching with parsed criteria: %#v", criteria) uids, err := w.search(criteria) if err != nil { return err diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go index 19a4497f..fcf1917d 100644 --- a/worker/mbox/worker.go +++ b/worker/mbox/worker.go @@ -10,7 +10,7 @@ import ( "path/filepath" "sort" - "git.sr.ht/~rjarry/aerc/logging" + "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/lib" @@ -69,7 +69,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { reterr = err break } else { - logging.Debugf("configured with mbox file %s", dir) + log.Debugf("configured with mbox file %s", dir) } case *types.Connect, *types.Reconnect, *types.Disconnect: @@ -106,7 +106,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) - logging.Debugf("%s opened", msg.Directory) + log.Debugf("%s opened", msg.Directory) case *types.FetchDirectoryContents: uids, err := filterUids(w.folder, w.folder.Uids(), msg.FilterCriteria) @@ -167,7 +167,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { case *types.FetchMessageBodyPart: m, err := w.folder.Message(msg.Uid) if err != nil { - logging.Errorf("could not get message %d: %v", msg.Uid, err) + log.Errorf("could not get message %d: %v", msg.Uid, err) reterr = err break } @@ -186,7 +186,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { r, err := lib.FetchEntityPartReader(fullMsg, msg.Part) if err != nil { - logging.Errorf( + log.Errorf( "could not get body part reader for message=%d, parts=%#v: %w", msg.Uid, msg.Part, err) reterr = err @@ -205,18 +205,18 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { for _, uid := range msg.Uids { m, err := w.folder.Message(uid) if err != nil { - logging.Errorf("could not get message for uid %d: %v", uid, err) + log.Errorf("could not get message for uid %d: %v", uid, err) continue } r, err := m.NewReader() if err != nil { - logging.Errorf("could not get message reader: %v", err) + log.Errorf("could not get message reader: %v", err) continue } defer r.Close() b, err := io.ReadAll(r) if err != nil { - logging.Errorf("could not get message reader: %v", err) + log.Errorf("could not get message reader: %v", err) continue } w.worker.PostMessage(&types.FullMessage{ @@ -251,16 +251,16 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { for _, uid := range msg.Uids { m, err := w.folder.Message(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) continue } if err := m.(*message).SetFlag(msg.Flag, msg.Enable); err != nil { - logging.Errorf("could change flag %v to %t on message: %v", msg.Flag, msg.Enable, err) + log.Errorf("could change flag %v to %t on message: %v", msg.Flag, msg.Enable, err) continue } info, err := lib.MessageInfo(m) if err != nil { - logging.Errorf("could not get message info: %v", err) + log.Errorf("could not get message info: %v", err) continue } @@ -377,12 +377,12 @@ func filterUids(folder *container, uids []uint32, args []string) ([]uint32, erro if err != nil { return nil, err } - logging.Debugf("Search with parsed criteria: %#v", criteria) + log.Debugf("Search with parsed criteria: %#v", criteria) m := make([]lib.RawMessage, 0, len(uids)) for _, uid := range uids { msg, err := folder.Message(uid) if err != nil { - logging.Errorf("failed to get message for uid: %d", uid) + log.Errorf("failed to get message for uid: %d", uid) continue } m = append(m, msg) @@ -397,12 +397,12 @@ func sortUids(folder *container, uids []uint32, for _, uid := range uids { m, err := folder.Message(uid) if err != nil { - logging.Errorf("could not get message %v", err) + log.Errorf("could not get message %v", err) continue } info, err := lib.MessageInfo(m) if err != nil { - logging.Errorf("could not get message info %v", err) + log.Errorf("could not get message info %v", err) continue } infos = append(infos, info) diff --git a/worker/notmuch/eventhandlers.go b/worker/notmuch/eventhandlers.go index 38875060..7cd9c6fc 100644 --- a/worker/notmuch/eventhandlers.go +++ b/worker/notmuch/eventhandlers.go @@ -7,7 +7,7 @@ import ( "fmt" "strconv" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -24,7 +24,7 @@ func (w *worker) handleUpdateDirCounts(ev eventType) error { if w.store != nil { folders, err := w.store.FolderMap() if err != nil { - logging.Errorf("failed listing directories: %v", err) + log.Errorf("failed listing directories: %v", err) return err } for name := range folders { diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index c3c92b7f..79bf5be3 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -9,7 +9,7 @@ import ( "time" "git.sr.ht/~rjarry/aerc/lib/uidstore" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/worker/types" notmuch "github.com/zenhack/go.notmuch" ) @@ -69,11 +69,11 @@ func (db *DB) withConnection(writable bool, cb func(*notmuch.DB) error) error { too_old := time.Now().After(db.lastOpenTime.Add(MAX_DB_AGE)) if db.db == nil || writable || too_old { if cerr := db.close(); cerr != nil { - logging.Errorf("failed to close the notmuch db: %v", cerr) + log.Errorf("failed to close the notmuch db: %v", cerr) } err := db.connect(writable) if err != nil { - logging.Errorf("failed to open the notmuch db: %v", err) + log.Errorf("failed to open the notmuch db: %v", err) return err } } @@ -81,7 +81,7 @@ func (db *DB) withConnection(writable bool, cb func(*notmuch.DB) error) error { if writable { // we need to close to commit the changes, else we block others if cerr := db.close(); cerr != nil { - logging.Errorf("failed to close the notmuch db: %v", cerr) + log.Errorf("failed to close the notmuch db: %v", cerr) } } return err @@ -307,12 +307,12 @@ func (db *DB) msgModify(key string, err = cb(msg) if err != nil { - logging.Warnf("callback failed: %v", err) + log.Warnf("callback failed: %v", err) } err = msg.TagsToMaildirFlags() if err != nil { - logging.Errorf("could not sync maildir flags: %v", err) + log.Errorf("could not sync maildir flags: %v", err) } return nil }) @@ -325,13 +325,13 @@ func (db *DB) MsgModifyTags(key string, add, remove []string) error { for _, t := range add { err := msg.AddTag(t) if err != nil { - logging.Warnf("failed to add tag: %v", err) + log.Warnf("failed to add tag: %v", err) } } for _, t := range remove { err := msg.RemoveTag(t) if err != nil { - logging.Warnf("failed to remove tag: %v", err) + log.Warnf("failed to remove tag: %v", err) } } }) diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go index 5f5e403c..b3022e4c 100644 --- a/worker/notmuch/worker.go +++ b/worker/notmuch/worker.go @@ -19,7 +19,7 @@ import ( "time" "git.sr.ht/~rjarry/aerc/config" - "git.sr.ht/~rjarry/aerc/logging" + "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/lib" @@ -68,18 +68,18 @@ func (w *worker) Run() { w.w.PostMessage(&types.Unsupported{ Message: types.RespondTo(msg), }, nil) - logging.Errorf("ProcessAction(%T) unsupported: %v", msg, err) + log.Errorf("ProcessAction(%T) unsupported: %v", msg, err) } else if err != nil { w.w.PostMessage(&types.Error{ Message: types.RespondTo(msg), Error: err, }, nil) - logging.Errorf("ProcessAction(%T) failure: %v", msg, err) + log.Errorf("ProcessAction(%T) failure: %v", msg, err) } case nmEvent := <-w.nmEvents: err := w.handleNotmuchEvent(nmEvent) if err != nil { - logging.Errorf("notmuch event failure: %v", err) + log.Errorf("notmuch event failure: %v", err) } } } @@ -165,7 +165,7 @@ func (w *worker) handleConfigure(msg *types.Configure) error { u, err := url.Parse(msg.Config.Source) if err != nil { - logging.Errorf("error configuring notmuch worker: %v", err) + log.Errorf("error configuring notmuch worker: %v", err) return err } home, err := homedir.Expand(u.Hostname()) @@ -204,7 +204,7 @@ func (w *worker) handleConnect(msg *types.Connect) error { w.done(msg) w.emitLabelList() go func() { - defer logging.PanicHandler() + defer log.PanicHandler() for { w.nmEvents <- &updateDirCounts{} @@ -218,7 +218,7 @@ func (w *worker) handleListDirectories(msg *types.ListDirectories) error { if w.store != nil { folders, err := w.store.FolderMap() if err != nil { - logging.Errorf("failed listing directories: %v", err) + log.Errorf("failed listing directories: %v", err) return err } for name := range folders { @@ -275,7 +275,7 @@ func (w *worker) getDirectoryInfo(name string, query string) *models.DirectoryIn } func (w *worker) handleOpenDirectory(msg *types.OpenDirectory) error { - logging.Tracef("opening %s", msg.Directory) + log.Tracef("opening %s", msg.Directory) var isDynamicFolder bool q := "" @@ -344,13 +344,13 @@ func (w *worker) handleFetchMessageHeaders( for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) w.w.PostMessageInfoError(msg, uid, err) continue } err = w.emitMessageInfo(m, msg) if err != nil { - logging.Errorf("could not emit message info: %v", err) + log.Errorf("could not emit message info: %v", err) w.w.PostMessageInfoError(msg, uid, err) continue } @@ -391,12 +391,12 @@ func (w *worker) handleFetchMessageBodyPart( ) error { m, err := w.msgFromUid(msg.Uid) if err != nil { - logging.Errorf("could not get message %d: %v", msg.Uid, err) + log.Errorf("could not get message %d: %v", msg.Uid, err) return err } r, err := m.NewBodyPartReader(msg.Part) if err != nil { - logging.Errorf( + log.Errorf( "could not get body part reader for message=%d, parts=%#v: %w", msg.Uid, msg.Part, err) return err @@ -417,12 +417,12 @@ func (w *worker) handleFetchFullMessages(msg *types.FetchFullMessages) error { for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message %d: %v", uid, err) + log.Errorf("could not get message %d: %v", uid, err) return err } r, err := m.NewReader() if err != nil { - logging.Errorf("could not get message reader: %v", err) + log.Errorf("could not get message reader: %v", err) return err } defer r.Close() @@ -446,18 +446,18 @@ func (w *worker) handleAnsweredMessages(msg *types.AnsweredMessages) error { for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) w.err(msg, err) continue } if err := m.MarkAnswered(msg.Answered); err != nil { - logging.Errorf("could not mark message as answered: %v", err) + log.Errorf("could not mark message as answered: %v", err) w.err(msg, err) continue } err = w.emitMessageInfo(m, msg) if err != nil { - logging.Errorf("could not emit message info: %v", err) + log.Errorf("could not emit message info: %v", err) w.err(msg, err) continue } @@ -473,18 +473,18 @@ func (w *worker) handleFlagMessages(msg *types.FlagMessages) error { for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) w.err(msg, err) continue } if err := m.SetFlag(msg.Flag, msg.Enable); err != nil { - logging.Errorf("could not set flag %v as %t for message: %v", msg.Flag, msg.Enable, err) + log.Errorf("could not set flag %v as %t for message: %v", msg.Flag, msg.Enable, err) w.err(msg, err) continue } err = w.emitMessageInfo(m, msg) if err != nil { - logging.Errorf("could not emit message info: %v", err) + log.Errorf("could not emit message info: %v", err) w.err(msg, err) continue } @@ -607,7 +607,7 @@ func (w *worker) emitDirectoryContents(parent types.WorkerMessage) error { } sortedUids, err := w.sort(uids, w.currentSortCriteria) if err != nil { - logging.Errorf("error sorting directory: %v", err) + log.Errorf("error sorting directory: %v", err) return err } w.w.PostMessage(&types.DirectoryContents{ @@ -652,7 +652,7 @@ func (w *worker) emitMessageInfo(m *Message, func (w *worker) emitLabelList() { tags, err := w.db.ListTags() if err != nil { - logging.Errorf("could not load tags: %v", err) + log.Errorf("could not load tags: %v", err) return } w.w.PostMessage(&types.LabelList{Labels: tags}, nil) @@ -668,19 +668,19 @@ func (w *worker) sort(uids []uint32, for _, uid := range uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) continue } info, err := m.MessageInfo() if err != nil { - logging.Errorf("could not get message info: %v", err) + log.Errorf("could not get message info: %v", err) continue } msgInfos = append(msgInfos, info) } sortedUids, err := lib.Sort(msgInfos, criteria) if err != nil { - logging.Errorf("could not sort the messages: %v", err) + log.Errorf("could not sort the messages: %v", err) return nil, err } return sortedUids, nil @@ -737,12 +737,12 @@ func (w *worker) handleDeleteMessages(msg *types.DeleteMessages) error { for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) w.err(msg, err) continue } if err := m.Remove(path); err != nil { - logging.Errorf("could not remove message: %v", err) + log.Errorf("could not remove message: %v", err) w.err(msg, err) continue } @@ -773,11 +773,11 @@ func (w *worker) handleCopyMessages(msg *types.CopyMessages) error { for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) return err } if err := m.Copy(dest); err != nil { - logging.Errorf("could not copy message: %v", err) + log.Errorf("could not copy message: %v", err) return err } } @@ -818,11 +818,11 @@ func (w *worker) handleMoveMessages(msg *types.MoveMessages) error { for _, uid := range msg.Uids { m, err := w.msgFromUid(uid) if err != nil { - logging.Errorf("could not get message: %v", err) + log.Errorf("could not get message: %v", err) break } if err := m.Move(source, dest); err != nil { - logging.Errorf("could not copy message: %v", err) + log.Errorf("could not copy message: %v", err) break } moved = append(moved, uid) @@ -851,7 +851,7 @@ func (w *worker) handleAppendMessage(msg *types.AppendMessage) error { } key, writer, err := dest.Create(lib.ToMaildirFlags(msg.Flags)) if err != nil { - logging.Errorf("could not create message at %s: %v", msg.Destination, err) + log.Errorf("could not create message at %s: %v", msg.Destination, err) return err } filename, err := dest.Filename(key) @@ -860,7 +860,7 @@ func (w *worker) handleAppendMessage(msg *types.AppendMessage) error { return err } if _, err := io.Copy(writer, msg.Reader); err != nil { - logging.Errorf("could not write message to destination: %v", err) + log.Errorf("could not write message to destination: %v", err) writer.Close() os.Remove(filename) return err @@ -883,7 +883,7 @@ func (w *worker) handleCreateDirectory(msg *types.CreateDirectory) error { dir := w.store.Dir(msg.Directory) if err := dir.Init(); err != nil { - logging.Errorf("could not create directory %s: %v", + log.Errorf("could not create directory %s: %v", msg.Directory, err) return err } @@ -898,7 +898,7 @@ func (w *worker) handleRemoveDirectory(msg *types.RemoveDirectory) error { dir := w.store.Dir(msg.Directory) if err := os.RemoveAll(string(dir)); err != nil { - logging.Errorf("could not remove directory %s: %v", + log.Errorf("could not remove directory %s: %v", msg.Directory, err) return err } @@ -933,7 +933,7 @@ func (w *worker) processNewMaildirFiles(dir string) error { // Force message to move from new/ to cur/ err = w.db.MsgModifyTags(key, nil, nil) if err != nil { - logging.Errorf("MsgModifyTags failed: %v", err) + log.Errorf("MsgModifyTags failed: %v", err) } } diff --git a/worker/types/thread.go b/worker/types/thread.go index bfe3edc7..2f739bc2 100644 --- a/worker/types/thread.go +++ b/worker/types/thread.go @@ -5,7 +5,7 @@ import ( "fmt" "sort" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" ) type Thread struct { @@ -80,7 +80,7 @@ func (t *Thread) Uids() []uint32 { return nil }) if err != nil { - logging.Errorf("walk to collect uids failed: %v", err) + log.Errorf("walk to collect uids failed: %v", err) } return uids } diff --git a/worker/types/worker.go b/worker/types/worker.go index 67cb9874..97712afd 100644 --- a/worker/types/worker.go +++ b/worker/types/worker.go @@ -6,7 +6,7 @@ import ( "sync/atomic" "git.sr.ht/~rjarry/aerc/lib/ui" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" ) @@ -84,9 +84,9 @@ func (worker *Worker) PostAction(msg WorkerMessage, cb func(msg WorkerMessage)) worker.setId(msg) if resp := msg.InResponseTo(); resp != nil { - logging.Tracef("PostAction %T:%T", msg, resp) + log.Tracef("PostAction %T:%T", msg, resp) } else { - logging.Tracef("PostAction %T", msg) + log.Tracef("PostAction %T", msg) } // write to Actions channel without blocking worker.queue(msg) @@ -107,9 +107,9 @@ func (worker *Worker) PostMessage(msg WorkerMessage, msg.setAccount(worker.Name) if resp := msg.InResponseTo(); resp != nil { - logging.Tracef("PostMessage %T:%T", msg, resp) + log.Tracef("PostMessage %T:%T", msg, resp) } else { - logging.Tracef("PostMessage %T", msg) + log.Tracef("PostMessage %T", msg) } ui.MsgChannel <- msg @@ -122,9 +122,9 @@ func (worker *Worker) PostMessage(msg WorkerMessage, func (worker *Worker) ProcessMessage(msg WorkerMessage) WorkerMessage { if resp := msg.InResponseTo(); resp != nil { - logging.Tracef("ProcessMessage %T(%d):%T(%d)", msg, msg.getId(), resp, resp.getId()) + log.Tracef("ProcessMessage %T(%d):%T(%d)", msg, msg.getId(), resp, resp.getId()) } else { - logging.Tracef("ProcessMessage %T(%d)", msg, msg.getId()) + log.Tracef("ProcessMessage %T(%d)", msg, msg.getId()) } if inResponseTo := msg.InResponseTo(); inResponseTo != nil { worker.Lock() @@ -144,9 +144,9 @@ func (worker *Worker) ProcessMessage(msg WorkerMessage) WorkerMessage { func (worker *Worker) ProcessAction(msg WorkerMessage) WorkerMessage { if resp := msg.InResponseTo(); resp != nil { - logging.Tracef("ProcessAction %T(%d):%T(%d)", msg, msg.getId(), resp, resp.getId()) + log.Tracef("ProcessAction %T(%d):%T(%d)", msg, msg.getId(), resp, resp.getId()) } else { - logging.Tracef("ProcessAction %T(%d)", msg, msg.getId()) + log.Tracef("ProcessAction %T(%d)", msg, msg.getId()) } if inResponseTo := msg.InResponseTo(); inResponseTo != nil { worker.Lock() |