From cd1999555714fb886493d2d04b6c472be55cebef Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 19 Jul 2022 22:31:51 +0200 Subject: logging: use level-based logger functions Do not pass logger objects around anymore. Shuffle some messages to make them consistent with the new logging API. Avoid using %v when a more specific verb exists for the argument types. The loggers are completely disabled (i.e. Sprintf is not even called) by default. They are only enabled when redirecting stdout to a file. Signed-off-by: Robin Jarry Acked-by: Moritz Poldrack --- commands/account/search.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'commands/account/search.go') diff --git a/commands/account/search.go b/commands/account/search.go index 7cae227f..290aafca 100644 --- a/commands/account/search.go +++ b/commands/account/search.go @@ -5,6 +5,7 @@ import ( "strings" "git.sr.ht/~rjarry/aerc/lib/statusline" + "git.sr.ht/~rjarry/aerc/logging" "git.sr.ht/~rjarry/aerc/widgets" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -42,7 +43,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, " "))) - acct.Logger().Printf("Filter results: %v", store.Uids()) + logging.Infof("Filter results: %v", store.Uids()) } } store.Sort(nil, cb) @@ -50,7 +51,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, " "))) - acct.Logger().Printf("Search results: %v", uids) + logging.Infof("Search results: %v", uids) store.ApplySearch(uids) // TODO: Remove when stores have multiple OnUpdate handlers acct.Messages().Invalidate() -- cgit