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 <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
This commit is contained in:
Robin Jarry 2022-07-19 22:31:51 +02:00
parent a1f779ccc9
commit cd19995557
43 changed files with 268 additions and 342 deletions
widgets

View file

@ -23,6 +23,7 @@ import (
"git.sr.ht/~rjarry/aerc/lib/format"
"git.sr.ht/~rjarry/aerc/lib/templates"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/logging"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/worker/types"
)
@ -89,7 +90,7 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
cmpl := completer.New(cmd, func(err error) {
aerc.PushError(
fmt.Sprintf("could not complete header: %v", err))
worker.Logger.Printf("could not complete header: %v", err)
logging.Errorf("could not complete header: %v", err)
})
email, err := ioutil.TempFile("", "aerc-compose-*.eml")