aboutsummaryrefslogtreecommitdiffstats
path: root/commands/account
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-11-23 10:43:44 +0100
committerRobin Jarry <robin@jarry.cc>2022-12-02 22:10:44 +0100
commit70f46757449c8f24b818f4dfc5dcb87da7e327d6 (patch)
treea8650017ccdae1f7a4aebbdf745a0fa4ae2c2286 /commands/account
parent3cd69ee953b169cf2e61b70948582df4a75cffc5 (diff)
downloadaerc-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/account')
-rw-r--r--commands/account/export-mbox.go2
-rw-r--r--commands/account/import-mbox.go4
-rw-r--r--commands/account/search.go4
3 files changed, 5 insertions, 5 deletions
diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go
index b68e1cc5..f51608b9 100644
--- a/commands/account/export-mbox.go
+++ b/commands/account/export-mbox.go
@@ -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.Infof(statusInfo)
+ logging.Debugf(statusInfo)
}()
return nil
diff --git a/commands/account/import-mbox.go b/commands/account/import-mbox.go
index 5a8a2ee6..93408aca 100644
--- a/commands/account/import-mbox.go
+++ b/commands/account/import-mbox.go
@@ -55,7 +55,7 @@ func (ImportMbox) Execute(aerc *widgets.Aerc, args []string) error {
importFolder := func() {
statusInfo := fmt.Sprintln("Importing", filename, "to folder", folder)
aerc.PushStatus(statusInfo, 10*time.Second)
- logging.Infof(statusInfo)
+ logging.Debugf(statusInfo)
f, err := os.Open(filename)
if err != nil {
aerc.PushError(err.Error())
@@ -123,7 +123,7 @@ func (ImportMbox) Execute(aerc *widgets.Aerc, args []string) error {
}
}
infoStr := fmt.Sprintf("%s: imported %d of %d sucessfully.", args[0], appended, len(messages))
- logging.Infof(infoStr)
+ logging.Debugf(infoStr)
aerc.SetStatus(infoStr)
}
diff --git a/commands/account/search.go b/commands/account/search.go
index b4942bf5..125cb5d7 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -44,7 +44,7 @@ func (SearchFilter) Execute(aerc *widgets.Aerc, args []string) error {
cb := func(msg types.WorkerMessage) {
if _, ok := msg.(*types.Done); ok {
acct.SetStatus(statusline.FilterResult(strings.Join(args, " ")))
- logging.Infof("Filter results: %v", store.Uids())
+ logging.Tracef("Filter results: %v", store.Uids())
}
}
store.Sort(store.GetCurrentSortCriteria(), cb)
@@ -52,7 +52,7 @@ func (SearchFilter) Execute(aerc *widgets.Aerc, args []string) error {
acct.SetStatus(statusline.Search("Searching..."))
cb := func(uids []uint32) {
acct.SetStatus(statusline.Search(strings.Join(args, " ")))
- logging.Infof("Search results: %v", uids)
+ logging.Tracef("Search results: %v", uids)
store.ApplySearch(uids)
// TODO: Remove when stores have multiple OnUpdate handlers
ui.Invalidate()