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 /widgets | |
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 'widgets')
-rw-r--r-- | widgets/account.go | 12 | ||||
-rw-r--r-- | widgets/aerc.go | 2 | ||||
-rw-r--r-- | widgets/compose.go | 4 | ||||
-rw-r--r-- | widgets/dirlist.go | 2 | ||||
-rw-r--r-- | widgets/msgviewer.go | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/widgets/account.go b/widgets/account.go index 5bbe97e1..ca899c93 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -235,7 +235,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { switch msg.InResponseTo().(type) { case *types.Connect, *types.Reconnect: acct.SetStatus(statusline.ConnectionActivity("Listing mailboxes...")) - logging.Debugf("Listing mailboxes...") + logging.Tracef("Listing mailboxes...") acct.dirlist.UpdateList(func(dirs []string) { var dir string for _, _dir := range dirs { @@ -251,14 +251,14 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { acct.dirlist.Select(dir) } acct.msglist.SetInitDone() - logging.Infof("%s connected.", acct.acct.Name) + logging.Infof("[%s] connected.", acct.acct.Name) acct.SetStatus(statusline.SetConnected(true)) acct.newConn = true }) case *types.Disconnect: acct.dirlist.ClearList() acct.msglist.SetStore(nil) - logging.Infof("%s disconnected.", acct.acct.Name) + logging.Infof("[%s] disconnected.", acct.acct.Name) acct.SetStatus(statusline.SetConnected(false)) case *types.OpenDirectory: if store, ok := acct.dirlist.SelectedMsgStore(); ok { @@ -347,13 +347,13 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { case *types.LabelList: acct.labels = msg.Labels case *types.ConnError: - logging.Errorf("%s connection error: %v", acct.acct.Name, msg.Error) + logging.Errorf("[%s] connection error: %v", acct.acct.Name, msg.Error) acct.SetStatus(statusline.SetConnected(false)) acct.PushError(msg.Error) acct.msglist.SetStore(nil) acct.worker.PostAction(&types.Reconnect{}, nil) case *types.Error: - logging.Errorf("%s unexpected error: %v", acct.acct.Name, msg.Error) + logging.Errorf("[%s] unexpected error: %v", acct.acct.Name, msg.Error) acct.PushError(msg.Error) } acct.UpdateStatus() @@ -427,7 +427,7 @@ func (acct *AccountView) CheckMail() { dirs := acct.dirlist.List() dirs = acct.dirlist.FilterDirs(dirs, acct.AccountConfig().CheckMailInclude, false) dirs = acct.dirlist.FilterDirs(dirs, exclude, true) - logging.Infof("Checking for new mail on account %s", acct.Name()) + logging.Debugf("Checking for new mail on account %s", acct.Name()) acct.SetStatus(statusline.ConnectionActivity("Checking for new mail...")) msg := &types.CheckMail{ Directories: dirs, diff --git a/widgets/aerc.go b/widgets/aerc.go index 163ba9e0..dce28c3e 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -750,7 +750,7 @@ func (aerc *Aerc) Mbox(source string) error { acctConf = *selectedAcct.acct info := fmt.Sprintf("Loading outgoing mbox mail settings from account [%s]", selectedAcct.Name()) aerc.PushStatus(info, 10*time.Second) - logging.Infof(info) + logging.Debugf(info) } else { acctConf.From = "<user@localhost>" } diff --git a/widgets/compose.go b/widgets/compose.go index ca7c8b8f..1bbdb477 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -109,7 +109,7 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig, func (c *Composer) SwitchAccount(newAcct *AccountView) error { if c.acct == newAcct { - logging.Infof("same accounts: no switch") + logging.Tracef("same accounts: no switch") return nil } // sync the header with the editors @@ -127,7 +127,7 @@ func (c *Composer) SwitchAccount(newAcct *AccountView) error { editor.loadValue() } c.Invalidate() - logging.Infof("account sucessfully switched") + logging.Debugf("account sucessfully switched") return nil } diff --git a/widgets/dirlist.go b/widgets/dirlist.go index 0f8431e9..4663d487 100644 --- a/widgets/dirlist.go +++ b/widgets/dirlist.go @@ -187,7 +187,7 @@ func (dirlist *DirectoryList) Select(name string) { }) dirlist.Invalidate() case <-ctx.Done(): - logging.Debugf("dirlist: skip %s", name) + logging.Tracef("dirlist: skip %s", name) return } }(ctx) diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 1cc2d6f5..019f9d6e 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -240,7 +240,7 @@ func createSwitcher(acct *AccountView, switcher *PartSwitcher, return err } selectedPriority := -1 - logging.Infof("Selecting best message from %v", conf.Viewer.Alternatives) + logging.Tracef("Selecting best message from %v", conf.Viewer.Alternatives) for i, pv := range switcher.parts { // Switch to user's preferred mimetype if switcher.selected == -1 && pv.part.MIMEType != "multipart" { |