diff options
author | Robin Jarry <robin@jarry.cc> | 2022-11-27 11:29:34 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-12-02 22:10:49 +0100 |
commit | 23a05d17ac1d23466ff73efa19576d43d06efe4b (patch) | |
tree | 49986587a62bdd89eb06ffa2aadf05f6d45cb3e7 /commands/account/export-mbox.go | |
parent | 70f46757449c8f24b818f4dfc5dcb87da7e327d6 (diff) | |
download | aerc-23a05d17ac1d23466ff73efa19576d43d06efe4b.tar.gz |
logging: rename package to log
Use the same name than the builtin "log" package. That way, we do not
risk logging in the wrong place.
Suggested-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'commands/account/export-mbox.go')
-rw-r--r-- | commands/account/export-mbox.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go index f51608b9..cbb56e61 100644 --- a/commands/account/export-mbox.go +++ b/commands/account/export-mbox.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "git.sr.ht/~rjarry/aerc/logging" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/widgets" mboxer "git.sr.ht/~rjarry/aerc/worker/mbox" "git.sr.ht/~rjarry/aerc/worker/types" @@ -55,7 +55,7 @@ func (ExportMbox) Execute(aerc *widgets.Aerc, args []string) error { go func() { file, err := os.Create(filename) if err != nil { - logging.Errorf("failed to create file: %v", err) + log.Errorf("failed to create file: %v", err) aerc.PushError(err.Error()) return } @@ -74,16 +74,16 @@ func (ExportMbox) Execute(aerc *widgets.Aerc, args []string) error { if retries > 0 { if retries > 10 { errorMsg := fmt.Sprintf("too many retries: %d; stopping export", retries) - logging.Errorf(errorMsg) + log.Errorf(errorMsg) aerc.PushError(args[0] + " " + errorMsg) break } sleeping := time.Duration(retries * 1e9 * 2) - logging.Debugf("sleeping for %s before retrying; retries: %d", sleeping, retries) + log.Debugf("sleeping for %s before retrying; retries: %d", sleeping, retries) time.Sleep(sleeping) } - logging.Debugf("fetching %d for export", len(uids)) + log.Debugf("fetching %d for export", len(uids)) acct.Worker().PostAction(&types.FetchFullMessages{ Uids: uids, }, func(msg types.WorkerMessage) { @@ -91,14 +91,14 @@ func (ExportMbox) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: done <- true case *types.Error: - logging.Errorf("failed to fetch message: %v", msg.Error) + log.Errorf("failed to fetch message: %v", msg.Error) aerc.PushError(args[0] + " error encountered: " + msg.Error.Error()) done <- false case *types.FullMessage: mu.Lock() err := mboxer.Write(file, msg.Content.Reader, "", t) if err != nil { - logging.Warnf("failed to write mbox: %v", err) + log.Warnf("failed to write mbox: %v", err) } for i, uid := range uids { if uid == msg.Content.Uid { @@ -117,7 +117,7 @@ func (ExportMbox) Execute(aerc *widgets.Aerc, args []string) error { } statusInfo := fmt.Sprintf("Exported %d of %d messages to %s.", ctr, len(store.Uids()), filename) aerc.PushStatus(statusInfo, 10*time.Second) - logging.Debugf(statusInfo) + log.Debugf(statusInfo) }() return nil |