Replace the old log setup, with structured logging etc.

Fixes #11124
This commit is contained in:
Bjørn Erik Pedersen
2023-06-16 08:17:42 +02:00
parent 0e79446586
commit 7c9fada778
80 changed files with 1273 additions and 1082 deletions

View File

@@ -19,7 +19,6 @@ import (
"path/filepath"
"github.com/gohugoio/hugo/common/loggers"
"github.com/spf13/afero"
)

View File

@@ -18,8 +18,8 @@ import (
"path/filepath"
"testing"
"github.com/bep/logg"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/htesting"
"github.com/spf13/afero"
@@ -64,11 +64,11 @@ func TestNoSymlinkFs(t *testing.T) {
blogDir := filepath.Join(workDir, "blog")
blogFile1 := filepath.Join(blogDir, "a.txt")
logger := loggers.NewWarningLogger()
logger := loggers.NewDefault()
for _, bfs := range []afero.Fs{NewBaseFileDecorator(Os), Os} {
for _, allowFiles := range []bool{false, true} {
logger.LogCounters().WarnCounter.Reset()
logger.Reset()
fs := NewNoSymlinkFs(bfs, logger, allowFiles)
ls := fs.(afero.Lstater)
symlinkedDir := filepath.Join(workDir, "symlinkdedir")
@@ -139,7 +139,7 @@ func TestNoSymlinkFs(t *testing.T) {
_, err = f.Readdir(-1)
c.Assert(err, qt.IsNil)
f.Close()
c.Assert(logger.LogCounters().WarnCounter.Count(), qt.Equals, uint64(1))
c.Assert(logger.LoggCount(logg.LevelWarn), qt.Equals, 1)
}
}

View File

@@ -86,7 +86,7 @@ func NewWalkway(cfg WalkwayConfig) *Walkway {
logger := cfg.Logger
if logger == nil {
logger = loggers.NewWarningLogger()
logger = loggers.NewDefault()
}
return &Walkway{