log in logfmt via zap, with nicer console output in dev
1 file changed, 4 insertions(+), 4 deletions(-)
changed files
M internal/server/filemap.go → internal/server/filemap.go
@@ -5,11 +5,11 @@ "fmt" "hash/fnv" "io" "io/fs" - "log" - "log/slog" "os" "path/filepath" "strings" + + "website/internal/log" "github.com/pkg/errors" )@@ -36,7 +36,7 @@ } func registerFile(urlpath string, filepath string) error { if files[urlpath] != (File{}) { - log.Printf("registerFile called with duplicate file, urlPath: %s", urlpath) + log.Info("registerFile called with duplicate file", "url_path", urlpath) return nil } hash, err := hashFile(filepath)@@ -61,7 +61,7 @@ return errors.WithMessagef(err, "failed to make path relative, path: %s", filePath) } urlPath, _ := strings.CutSuffix(relPath, "index.html") if !f.IsDir() { - slog.Debug("registering file", "urlpath", "/"+urlPath) + log.Debug("registering file", "urlpath", "/"+urlPath) return registerFile("/"+urlPath, filePath) } return nil