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 /worker/maildir/container.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 'worker/maildir/container.go')
-rw-r--r-- | worker/maildir/container.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/worker/maildir/container.go b/worker/maildir/container.go index fb0b1902..83f850ab 100644 --- a/worker/maildir/container.go +++ b/worker/maildir/container.go @@ -2,7 +2,6 @@ package maildir import ( "fmt" - "log" "os" "path/filepath" "sort" @@ -17,14 +16,13 @@ import ( // the Maildir spec type Container struct { dir string - log *log.Logger uids *uidstore.Store recentUIDS map[uint32]struct{} // used to set the recent flag maildirpp bool // whether to use Maildir++ directory layout } // NewContainer creates a new container at the specified directory -func NewContainer(dir string, l *log.Logger, maildirpp bool) (*Container, error) { +func NewContainer(dir string, maildirpp bool) (*Container, error) { f, err := os.Open(dir) if err != nil { return nil, err @@ -37,7 +35,7 @@ func NewContainer(dir string, l *log.Logger, maildirpp bool) (*Container, error) if !s.IsDir() { return nil, fmt.Errorf("Given maildir '%s' not a directory", dir) } - return &Container{dir: dir, uids: uidstore.NewStore(), log: l, + return &Container{dir: dir, uids: uidstore.NewStore(), recentUIDS: make(map[uint32]struct{}), maildirpp: maildirpp}, nil } |