Improve logging

- Actually log useful information at their respective log level.
- Add logs in hot-paths to be able to deep-dive and debug specific
requests (see server/handler.go)
- Remove zerologger and instead use custom logger that doesn't log
JSON (directly inspired by https://codeberg.org/Codeberg/moderation/pulls/7).
- Add more information to existing fields(e.g. the host that the user is
visiting, this was noted by @fnetX).
This commit is contained in:
Gusted 2022-07-24 06:22:52 +02:00
parent 00e8a41c89
commit 1e183d7249
No known key found for this signature in database
GPG key ID: FD821B732837125F
13 changed files with 318 additions and 110 deletions

View file

@ -7,10 +7,10 @@ import (
"fmt"
"time"
"codeberg.org/codeberg/pages/server/log"
"github.com/akrylysov/pogreb"
"github.com/akrylysov/pogreb/fs"
"github.com/go-acme/lego/v4/certificate"
"github.com/rs/zerolog/log"
)
var _ CertDB = aDB{}
@ -72,7 +72,7 @@ func (p aDB) sync() {
for {
err := p.intern.Sync()
if err != nil {
log.Err(err).Msg("Syncing cert database failed")
log.Error("Syncing cert database failed: %v", err)
}
select {
case <-p.ctx.Done():