diff options
author | Robin Jarry <robin@jarry.cc> | 2022-07-19 22:31:51 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-07-23 22:52:15 +0200 |
commit | cd1999555714fb886493d2d04b6c472be55cebef (patch) | |
tree | 1df3bcf5f687752db671d8bc9c7eab8a5c0fde71 /lib/crypto/pgp/pgp.go | |
parent | a1f779ccc9b16b22ad6cb2e0bf73c290fd0cc756 (diff) | |
download | aerc-cd1999555714fb886493d2d04b6c472be55cebef.tar.gz |
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>
Diffstat (limited to 'lib/crypto/pgp/pgp.go')
-rw-r--r-- | lib/crypto/pgp/pgp.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/crypto/pgp/pgp.go b/lib/crypto/pgp/pgp.go index 4dbe37c7..647b091b 100644 --- a/lib/crypto/pgp/pgp.go +++ b/lib/crypto/pgp/pgp.go @@ -5,12 +5,12 @@ import ( "fmt" "io" "io/ioutil" - "log" "os" "path" "strings" "time" + "git.sr.ht/~rjarry/aerc/logging" "git.sr.ht/~rjarry/aerc/models" "github.com/ProtonMail/go-crypto/openpgp" "github.com/ProtonMail/go-crypto/openpgp/armor" @@ -21,9 +21,7 @@ import ( "github.com/pkg/errors" ) -type Mail struct { - logger *log.Logger -} +type Mail struct{} var ( Keyring openpgp.EntityList @@ -31,9 +29,8 @@ var ( locked bool ) -func (m *Mail) Init(l *log.Logger) error { - m.logger = l - m.logger.Println("Initializing PGP keyring") +func (m *Mail) Init() error { + logging.Infof("Initializing PGP keyring") os.MkdirAll(path.Join(xdg.DataHome(), "aerc"), 0700) lockpath := path.Join(xdg.DataHome(), "aerc", "keyring.lock") |