aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-11-27 11:29:34 +0100
committerRobin Jarry <robin@jarry.cc>2022-12-02 22:10:49 +0100
commit23a05d17ac1d23466ff73efa19576d43d06efe4b (patch)
tree49986587a62bdd89eb06ffa2aadf05f6d45cb3e7 /commands/compose
parent70f46757449c8f24b818f4dfc5dcb87da7e327d6 (diff)
downloadaerc-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/compose')
-rw-r--r--commands/compose/attach.go23
-rw-r--r--commands/compose/postpone.go8
-rw-r--r--commands/compose/send.go8
3 files changed, 19 insertions, 20 deletions
diff --git a/commands/compose/attach.go b/commands/compose/attach.go
index de83ef0b..62ae0291 100644
--- a/commands/compose/attach.go
+++ b/commands/compose/attach.go
@@ -12,7 +12,7 @@ import (
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/lib/ui"
- "git.sr.ht/~rjarry/aerc/logging"
+ "git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/widgets"
"github.com/mitchellh/go-homedir"
)
@@ -47,24 +47,24 @@ func (a Attach) Execute(aerc *widgets.Aerc, args []string) error {
func (a Attach) addPath(aerc *widgets.Aerc, path string) error {
path, err := homedir.Expand(path)
if err != nil {
- logging.Errorf("failed to expand path '%s': %v", path, err)
+ log.Errorf("failed to expand path '%s': %v", path, err)
aerc.PushError(err.Error())
return err
}
attachments, err := filepath.Glob(path)
if err != nil && errors.Is(err, filepath.ErrBadPattern) {
- logging.Warnf("failed to parse as globbing pattern: %v", err)
+ log.Warnf("failed to parse as globbing pattern: %v", err)
attachments = []string{path}
}
composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
for _, attach := range attachments {
- logging.Debugf("attaching '%s'", attach)
+ log.Debugf("attaching '%s'", attach)
pathinfo, err := os.Stat(attach)
if err != nil {
- logging.Errorf("failed to stat file: %v", err)
+ log.Errorf("failed to stat file: %v", err)
aerc.PushError(err.Error())
return err
} else if pathinfo.IsDir() && len(attachments) == 1 {
@@ -113,23 +113,23 @@ func (a Attach) openMenu(aerc *widgets.Aerc, args []string) error {
t.OnClose = func(err error) {
defer func() {
if err := picks.Close(); err != nil {
- logging.Errorf("error closing file: %v", err)
+ log.Errorf("error closing file: %v", err)
}
if err := os.Remove(picks.Name()); err != nil {
- logging.Errorf("could not remove tmp file: %v", err)
+ log.Errorf("could not remove tmp file: %v", err)
}
}()
aerc.CloseDialog()
if err != nil {
- logging.Errorf("terminal closed with error: %v", err)
+ log.Errorf("terminal closed with error: %v", err)
return
}
_, err = picks.Seek(0, io.SeekStart)
if err != nil {
- logging.Errorf("seek failed: %v", err)
+ log.Errorf("seek failed: %v", err)
return
}
@@ -139,11 +139,10 @@ func (a Attach) openMenu(aerc *widgets.Aerc, args []string) error {
if _, err := os.Stat(f); err != nil {
continue
}
- logging.Tracef("File picker attaches: %v", f)
+ log.Tracef("File picker attaches: %v", f)
err := a.addPath(aerc, f)
if err != nil {
- logging.Errorf(
- "attach failed for file %s: %v", f, err)
+ log.Errorf("attach failed for file %s: %v", f, err)
}
}
diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go
index 2572d8d5..eb7bc0a3 100644
--- a/commands/compose/postpone.go
+++ b/commands/compose/postpone.go
@@ -7,7 +7,7 @@ import (
"github.com/miolini/datacounter"
"github.com/pkg/errors"
- "git.sr.ht/~rjarry/aerc/logging"
+ "git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/widgets"
"git.sr.ht/~rjarry/aerc/worker/types"
@@ -47,7 +47,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error {
return errors.New("No Postpone location configured")
}
- logging.Tracef("Postponing mail")
+ log.Tracef("Postponing mail")
header, err := composer.PrepareHeader()
if err != nil {
@@ -70,7 +70,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error {
// run this as a goroutine so we can make other progress. The message
// will be saved once the directory is created.
go func() {
- defer logging.PanicHandler()
+ defer log.PanicHandler()
errStr := <-errChan
if errStr != "" {
@@ -80,7 +80,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error {
handleErr := func(err error) {
aerc.PushError(err.Error())
- logging.Errorf("Postponing failed: %v", err)
+ log.Errorf("Postponing failed: %v", err)
aerc.NewTab(composer, tabName)
}
diff --git a/commands/compose/send.go b/commands/compose/send.go
index ccfe7886..6d9bfe25 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -17,7 +17,7 @@ import (
"git.sr.ht/~rjarry/aerc/commands/mode"
"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/widgets"
"git.sr.ht/~rjarry/aerc/worker/types"
@@ -104,7 +104,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
if err != nil || warn {
msg := "You may have forgotten an attachment."
if err != nil {
- logging.Warnf("failed to check for a forgotten attachment: %v", err)
+ log.Warnf("failed to check for a forgotten attachment: %v", err)
msg = "Failed to check for a forgotten attachment."
}
@@ -148,7 +148,7 @@ func send(aerc *widgets.Aerc, composer *widgets.Composer, ctx sendCtx,
failCh := make(chan error)
// writer
go func() {
- defer logging.PanicHandler()
+ defer log.PanicHandler()
var sender io.WriteCloser
var err error
@@ -182,7 +182,7 @@ func send(aerc *widgets.Aerc, composer *widgets.Composer, ctx sendCtx,
// cleanup + copy to sent
go func() {
- defer logging.PanicHandler()
+ defer log.PanicHandler()
// leave no-quit mode
defer mode.NoQuitDone()