all repos — website @ 09ee2de72936ea0b0edc5d3360ce1c72803a817b

My website

log in logfmt via zap, with nicer console output in dev

Alan Pearce
commit

09ee2de72936ea0b0edc5d3360ce1c72803a817b

parent

4064f933a965f2fb2ce43d3c2d5bd54ccd33978c

1 file changed, 4 insertions(+), 4 deletions(-)

changed files
M internal/server/filemap.gointernal/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