From 23a05d17ac1d23466ff73efa19576d43d06efe4b Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sun, 27 Nov 2022 11:29:34 +0100 Subject: 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 Signed-off-by: Robin Jarry Tested-by: Bence Ferdinandy Acked-by: Tim Culverhouse --- commands/msg/archive.go | 4 ++-- commands/msg/envelope.go | 4 ++-- commands/msg/forward.go | 14 +++++++------- commands/msg/invite.go | 4 ++-- commands/msg/pipe.go | 10 +++++----- commands/msg/recall.go | 10 +++++----- commands/msg/reply.go | 10 +++++----- commands/msg/unsubscribe.go | 6 +++--- 8 files changed, 31 insertions(+), 31 deletions(-) (limited to 'commands/msg') diff --git a/commands/msg/archive.go b/commands/msg/archive.go index b0c7b038..149d7a5f 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -7,7 +7,7 @@ import ( "sync" "git.sr.ht/~rjarry/aerc/commands" - "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" @@ -101,7 +101,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error { } // we need to do that in the background, else we block the main thread go func() { - defer logging.PanicHandler() + defer log.PanicHandler() wg.Wait() if success { diff --git a/commands/msg/envelope.go b/commands/msg/envelope.go index 616798d8..1b16d16f 100644 --- a/commands/msg/envelope.go +++ b/commands/msg/envelope.go @@ -6,7 +6,7 @@ import ( "strings" "git.sr.ht/~rjarry/aerc/lib/format" - "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/~sircmpwn/getopt" @@ -127,7 +127,7 @@ func parseHeader(msg *models.MessageInfo, fmtStr string) (result []string) { for hf.Next() { text, err := hf.Text() if err != nil { - logging.Errorf(err.Error()) + log.Errorf(err.Error()) text = hf.Value() } result = append(result, diff --git a/commands/msg/forward.go b/commands/msg/forward.go index 74ee6575..c0215aee 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -15,7 +15,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/format" "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" "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" @@ -74,7 +74,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { if err != nil { return err } - logging.Debugf("Forwarding email <%s>", msg.Envelope.MessageId) + log.Debugf("Forwarding email <%s>", msg.Envelope.MessageId) h := &mail.Header{} subject := "Fwd: " + msg.Envelope.Subject @@ -133,10 +133,10 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { store.FetchFull([]uint32{msg.Uid}, func(fm *types.FullMessage) { tmpFile, err := os.Create(tmpFileName) if err != nil { - logging.Warnf("failed to create temporary attachment: %v", err) + log.Warnf("failed to create temporary attachment: %v", err) _, err = addTab() if err != nil { - logging.Warnf("failed to add tab: %v", err) + log.Warnf("failed to add tab: %v", err) } return } @@ -144,7 +144,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { defer tmpFile.Close() _, err = io.Copy(tmpFile, fm.Content.Reader) if err != nil { - logging.Warnf("failed to write to tmpfile: %v", err) + log.Warnf("failed to write to tmpfile: %v", err) return } composer, err := addTab() @@ -194,7 +194,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { } bs, err := msg.BodyStructure.PartAtIndex(p) if err != nil { - logging.Errorf("cannot get PartAtIndex %v: %v", p, err) + log.Errorf("cannot get PartAtIndex %v: %v", p, err) continue } store.FetchBodyPart(msg.Uid, p, func(reader io.Reader) { @@ -208,7 +208,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { err := composer.AddPartAttachment(name, mime, params, reader) mu.Unlock() if err != nil { - logging.Errorf(err.Error()) + log.Errorf(err.Error()) aerc.PushError(err.Error()) } }) diff --git a/commands/msg/invite.go b/commands/msg/invite.go index 4b2507f4..32251643 100644 --- a/commands/msg/invite.go +++ b/commands/msg/invite.go @@ -9,7 +9,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib/calendar" "git.sr.ht/~rjarry/aerc/lib/format" "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" "git.sr.ht/~rjarry/aerc/widgets" "github.com/emersion/go-message/mail" @@ -187,7 +187,7 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { } else { err := addTab(cr) if err != nil { - logging.Warnf("failed to add tab: %v", err) + log.Warnf("failed to add tab: %v", err) } } }) diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 4a5a6168..878fd18c 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -10,7 +10,7 @@ import ( "time" "git.sr.ht/~rjarry/aerc/commands" - "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" @@ -92,12 +92,12 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { return } go func() { - defer logging.PanicHandler() + defer log.PanicHandler() defer pipe.Close() _, err := io.Copy(pipe, reader) if err != nil { - logging.Errorf("failed to send data to pipe: %v", err) + log.Errorf("failed to send data to pipe: %v", err) } }() err = ecmd.Run() @@ -166,7 +166,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { }) go func() { - defer logging.PanicHandler() + defer log.PanicHandler() select { case <-done: @@ -245,7 +245,7 @@ func newMessagesReader(messages []*types.FullMessage, useMbox bool) io.Reader { _, err = io.Copy(pw, msg.Content.Reader) } if err != nil { - logging.Warnf("failed to write data: %v", err) + log.Warnf("failed to write data: %v", err) } } }() diff --git a/commands/msg/recall.go b/commands/msg/recall.go index eb8195f8..d39f4daf 100644 --- a/commands/msg/recall.go +++ b/commands/msg/recall.go @@ -14,7 +14,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib" "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" "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" @@ -70,7 +70,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { if err != nil { return errors.Wrap(err, "Recall failed") } - logging.Debugf("Recalling message <%s>", msgInfo.Envelope.MessageId) + log.Debugf("Recalling message <%s>", msgInfo.Envelope.MessageId) composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(), acct.Worker(), "", msgInfo.RFC822Headers, @@ -185,7 +185,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { if md.IsSigned { err = composer.SetSign(md.IsSigned) if err != nil { - logging.Warnf("failed to set signed state: %v", err) + log.Warnf("failed to set signed state: %v", err) } } } @@ -200,7 +200,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { } bs, err := msg.BodyStructure().PartAtIndex(p) if err != nil { - logging.Warnf("cannot get PartAtIndex %v: %v", p, err) + log.Warnf("cannot get PartAtIndex %v: %v", p, err) continue } msg.FetchBodyPart(p, func(reader io.Reader) { @@ -214,7 +214,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { err := composer.AddPartAttachment(name, mime, params, reader) mu.Unlock() if err != nil { - logging.Errorf(err.Error()) + log.Errorf(err.Error()) aerc.PushError(err.Error()) } }) diff --git a/commands/msg/reply.go b/commands/msg/reply.go index bd57f4b1..066eaca3 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -14,7 +14,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib/crypto" "git.sr.ht/~rjarry/aerc/lib/format" "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" "git.sr.ht/~rjarry/aerc/widgets" "github.com/emersion/go-message/mail" @@ -226,12 +226,12 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { buf := new(bytes.Buffer) _, err := buf.ReadFrom(reader) if err != nil { - logging.Warnf("failed to fetch bodypart: %v", err) + log.Warnf("failed to fetch bodypart: %v", err) } original.Text = buf.String() err = addTab() if err != nil { - logging.Warnf("failed to add tab: %v", err) + log.Warnf("failed to add tab: %v", err) } }) return nil @@ -254,12 +254,12 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { buf := new(bytes.Buffer) _, err := buf.ReadFrom(reader) if err != nil { - logging.Warnf("failed to fetch bodypart: %v", err) + log.Warnf("failed to fetch bodypart: %v", err) } original.Text = buf.String() err = addTab() if err != nil { - logging.Warnf("failed to add tab: %v", err) + log.Warnf("failed to add tab: %v", err) } }) return nil diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go index 72c839fe..0538b2f2 100644 --- a/commands/msg/unsubscribe.go +++ b/commands/msg/unsubscribe.go @@ -10,7 +10,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib" "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" "git.sr.ht/~rjarry/aerc/widgets" "github.com/emersion/go-message/mail" @@ -56,10 +56,10 @@ func (Unsubscribe) Execute(aerc *widgets.Aerc, args []string) error { if len(methods) == 0 { return fmt.Errorf("no methods found to unsubscribe") } - logging.Debugf("unsubscribe: found %d methods", len(methods)) + log.Debugf("unsubscribe: found %d methods", len(methods)) unsubscribe := func(method *url.URL) { - logging.Debugf("unsubscribe: trying to unsubscribe using %s", method.Scheme) + log.Debugf("unsubscribe: trying to unsubscribe using %s", method.Scheme) var err error switch strings.ToLower(method.Scheme) { case "mailto": -- cgit