diff options
author | Robin Jarry <robin@jarry.cc> | 2022-11-23 10:43:44 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-12-02 22:10:44 +0100 |
commit | 70f46757449c8f24b818f4dfc5dcb87da7e327d6 (patch) | |
tree | a8650017ccdae1f7a4aebbdf745a0fa4ae2c2286 /commands/compose/attach.go | |
parent | 3cd69ee953b169cf2e61b70948582df4a75cffc5 (diff) | |
download | aerc-70f46757449c8f24b818f4dfc5dcb87da7e327d6.tar.gz |
logging: homogenize levels
The main goal is to ensure that by default, the log file (if configured)
does not grow out of proportions. Most of the logging messages in aerc
are actually for debugging and/or trace purposes.
Define clear rules for logging levels. Enforce these rules everywhere.
After this patch, here is what the log file looks like after starting up
with a single account:
INFO 2022/11/24 20:26:16.147164 aerc.go:176: Starting up version 0.13.0-100-g683981479c60 (go1.18.7 amd64 linux)
INFO 2022/11/24 20:26:17.546448 account.go:254: [work] connected.
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/attach.go')
-rw-r--r-- | commands/compose/attach.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/commands/compose/attach.go b/commands/compose/attach.go index af5c023c..de83ef0b 100644 --- a/commands/compose/attach.go +++ b/commands/compose/attach.go @@ -52,16 +52,12 @@ func (a Attach) addPath(aerc *widgets.Aerc, path string) error { return err } - logging.Debugf("attaching %s", path) - attachments, err := filepath.Glob(path) if err != nil && errors.Is(err, filepath.ErrBadPattern) { logging.Warnf("failed to parse as globbing pattern: %v", err) attachments = []string{path} } - logging.Debugf("filenames: %v", attachments) - composer, _ := aerc.SelectedTabContent().(*widgets.Composer) for _, attach := range attachments { logging.Debugf("attaching '%s'", attach) @@ -134,6 +130,7 @@ func (a Attach) openMenu(aerc *widgets.Aerc, args []string) error { _, err = picks.Seek(0, io.SeekStart) if err != nil { logging.Errorf("seek failed: %v", err) + return } scanner := bufio.NewScanner(picks) @@ -142,11 +139,11 @@ func (a Attach) openMenu(aerc *widgets.Aerc, args []string) error { if _, err := os.Stat(f); err != nil { continue } - logging.Infof("File picker attaches: %v", f) + logging.Tracef("File picker attaches: %v", f) err := a.addPath(aerc, f) if err != nil { - logging.Errorf("attach failed "+ - "for file %s: %v", f, err) + logging.Errorf( + "attach failed for file %s: %v", f, err) } } |