about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cmd/build/main.go10
-rw-r--r--cmd/cspgenerator/cspgenerator.go3
-rw-r--r--cmd/server/main.go4
-rw-r--r--go.mod1
-rw-r--r--go.sum32
-rw-r--r--internal/builder/builder.go18
-rw-r--r--internal/config/config.go2
-rw-r--r--internal/content/posts.go16
-rw-r--r--internal/listenfd/listenfd.go11
-rw-r--r--internal/log/log.go66
-rw-r--r--internal/server/dev.go19
-rw-r--r--internal/server/logging.go2
-rw-r--r--internal/server/mime.go6
-rw-r--r--internal/server/server.go32
-rw-r--r--internal/server/tcp.go2
-rw-r--r--internal/server/tls.go7
-rw-r--r--internal/vcs/repository.go13
-rw-r--r--internal/website/filemap.go2
-rw-r--r--internal/website/mux.go12
19 files changed, 169 insertions, 89 deletions
diff --git a/cmd/build/main.go b/cmd/build/main.go
index 14175e9..39cbc1b 100644
--- a/cmd/build/main.go
+++ b/cmd/build/main.go
@@ -5,6 +5,7 @@ import (
 	"os"
 
 	"go.alanpearce.eu/website/internal/builder"
+	"go.alanpearce.eu/website/internal/config"
 	"go.alanpearce.eu/website/internal/log"
 
 	"github.com/ardanlabs/conf/v3"
@@ -20,7 +21,7 @@ func main() {
 		}
 		panic("error parsing configuration: " + err.Error())
 	}
-	log.Configure(!ioConfig.Development)
+	log := log.Configure(!ioConfig.Development)
 
 	log.Debug("starting build process")
 	if ioConfig.Source != "." {
@@ -29,7 +30,12 @@ func main() {
 			log.Panic("could not change to source directory")
 		}
 	}
-	_, err := builder.BuildSite(ioConfig, nil)
+	cfg, err := config.GetConfig(ioConfig.Source, log)
+	if err != nil {
+		log.Error("could not read config", "error", err)
+	}
+
+	_, err = builder.BuildSite(ioConfig, cfg, log)
 	if err != nil {
 		log.Error("could not build site", "error", err)
 		os.Exit(1)
diff --git a/cmd/cspgenerator/cspgenerator.go b/cmd/cspgenerator/cspgenerator.go
index 1b9b9ba..0252d32 100644
--- a/cmd/cspgenerator/cspgenerator.go
+++ b/cmd/cspgenerator/cspgenerator.go
@@ -2,12 +2,11 @@ package main
 
 import (
 	"go.alanpearce.eu/website/internal/config"
-	"go.alanpearce.eu/website/internal/log"
 )
 
 func main() {
 	err := config.GenerateCSP()
 	if err != nil {
-		log.Fatal("error generating csp", "error", err)
+		panic(err)
 	}
 }
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 576cfb3..b74a0cc 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -23,7 +23,7 @@ func main() {
 		}
 		panic("parsing runtime configuration" + err.Error())
 	}
-	log.Configure(!runtimeConfig.Development)
+	log := log.Configure(!runtimeConfig.Development)
 
 	if runtimeConfig.Development {
 		tmpdir, err := os.MkdirTemp("", "website")
@@ -34,7 +34,7 @@ func main() {
 		runtimeConfig.Root = tmpdir
 	}
 
-	sv, err := server.New(&runtimeConfig)
+	sv, err := server.New(&runtimeConfig, log)
 	if err != nil {
 		log.Error("could not create server", "error", err)
 
diff --git a/go.mod b/go.mod
index 3aa7fcf..35f61c5 100644
--- a/go.mod
+++ b/go.mod
@@ -29,6 +29,7 @@ require (
 	github.com/yuin/goldmark v1.7.4
 	gitlab.com/tozd/go/errors v0.8.1
 	go.uber.org/zap v1.27.0
+	moul.io/zapfilter v1.7.0
 )
 
 require (
diff --git a/go.sum b/go.sum
index 52b992b..a579a5a 100644
--- a/go.sum
+++ b/go.sum
@@ -34,6 +34,7 @@ github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b h1:uUXgbcPDK3KpW29o
 github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
 github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
 github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
+github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
 github.com/benpate/derp v0.31.0 h1:Vo3oQrD+eDLY/FQ4W3HUtV1Et7lkm8OEF6rJQlSd6xg=
 github.com/benpate/derp v0.31.0/go.mod h1:y+PJWv5VOBOnd1y4CGk/c7xVS0Pwxg9BGQE5r/SGc8w=
 github.com/benpate/digit v0.12.1 h1:2Dx6IJbvvIlPMKJCSG7/XQJ/Y8BDJGVanzrGfLkWq1c=
@@ -154,6 +155,7 @@ github.com/pberkel/caddy-storage-redis v1.2.0 h1:CqJ9K4z2DAHF+euR0295QjEfNhbV/HA
 github.com/pberkel/caddy-storage-redis v1.2.0/go.mod h1:ztw2IxbDCQ+NUrD841IvdcwiGyh1m1HgB2nBj/geS4I=
 github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
 github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
+github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7/go.mod h1:zO8QMzTeZd5cpnIkz/Gn6iK0jDfGicM1nynOkkPIl28=
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
 github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -180,6 +182,7 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU
 github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
 github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
 github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
 github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
 github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
@@ -204,10 +207,13 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
 github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 github.com/sykesm/zap-logfmt v0.0.4 h1:U2WzRvmIWG1wDLCFY3sz8UeEmsdHQjHFNlIdmroVFaI=
 github.com/sykesm/zap-logfmt v0.0.4/go.mod h1:AuBd9xQjAe3URrWT1BBDk2v2onAZHkZkWRMiYZXiZWA=
+github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
 github.com/thessem/zap-prettyconsole v0.5.0 h1:AOu1GGUuDkGmj4tgRPSVf0vYGzDM+6cPWjKOcmjEcQs=
 github.com/thessem/zap-prettyconsole v0.5.0/go.mod h1:3qfsE7y+bLOq7EQ+fMZHD3HYEp24ULFf5nhLSx6rjrE=
 github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
 github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
 github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg=
 github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
@@ -220,23 +226,31 @@ github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l
 gitlab.com/tozd/go/errors v0.8.1 h1:RfylffRAsl3PbDdHNUBEkTleTCiL/RIT+Ef8p0HRNCI=
 gitlab.com/tozd/go/errors v0.8.1/go.mod h1:PvIdUMLpPwxr+KEBxghQaCMydHXGYdJQn/PhdMqYREY=
 go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
+go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
+go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
 go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
 go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
+go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
 go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
 go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
 go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
 go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
+go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
+go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
 go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
 go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
 go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
 go.uber.org/zap v1.12.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
+go.uber.org/zap v1.20.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
 go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
 go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
 go.uber.org/zap/exp v0.2.0 h1:FtGenNNeCATRB3CmB/yEUnjEFeJWpB/pMcy7e2bKPYs=
 go.uber.org/zap/exp v0.2.0/go.mod h1:t0gqAIdh1MfKv9EwN/dLwfZnJxe9ITAZN78HEWPFWDQ=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
@@ -249,6 +263,9 @@ golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0J
 golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
 golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
 golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
@@ -256,7 +273,9 @@ golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
 golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
 golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
 golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
@@ -267,6 +286,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
 golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
 golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
@@ -274,9 +295,12 @@ golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -316,11 +340,15 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw
 golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
 golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
 golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
 golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
 golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
 google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -332,10 +360,14 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
 gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
 gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
 gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+moul.io/zapfilter v1.7.0 h1:7aFrG4N72bDH9a2BtYUuUaDS981Dxu3qybWfeqaeBDU=
+moul.io/zapfilter v1.7.0/go.mod h1:M+N2s+qZiA+bzRoyKMVRxyuERijS2ovi2pnMyiOGMvc=
diff --git a/internal/builder/builder.go b/internal/builder/builder.go
index 0d4b1fc..b6da17d 100644
--- a/internal/builder/builder.go
+++ b/internal/builder/builder.go
@@ -93,7 +93,7 @@ func joinSourcePath(src string) func(string) string {
 	}
 }
 
-func build(ioConfig *IOConfig, config *config.Config) (*Result, error) {
+func build(ioConfig *IOConfig, config *config.Config, log *log.Logger) (*Result, error) {
 	outDir := ioConfig.Destination
 	joinSource := joinSourcePath(ioConfig.Source)
 	log.Debug("output", "dir", outDir)
@@ -110,7 +110,11 @@ func build(ioConfig *IOConfig, config *config.Config) (*Result, error) {
 		return nil, errors.WithMessage(err, "could not create post output directory")
 	}
 	log.Debug("reading posts")
-	posts, tags, err := content.ReadPosts(joinSource("content"), "post", outDir)
+	posts, tags, err := content.ReadPosts(&content.Config{
+		Root:      joinSource("content"),
+		InputDir:  "post",
+		OutputDir: outDir,
+	}, log.Named("content"))
 	if err != nil {
 		return nil, err
 	}
@@ -254,13 +258,9 @@ func build(ioConfig *IOConfig, config *config.Config) (*Result, error) {
 	return r, nil
 }
 
-func BuildSite(ioConfig *IOConfig, cfg *config.Config) (*Result, error) {
+func BuildSite(ioConfig *IOConfig, cfg *config.Config, log *log.Logger) (*Result, error) {
 	if cfg == nil {
-		var err error
-		cfg, err = config.GetConfig(ioConfig.Source)
-		if err != nil {
-			return nil, errors.WithMessage(err, "could not get config")
-		}
+		return nil, errors.New("config is nil")
 	}
 	cfg.InjectLiveReload = ioConfig.Development
 	compressFiles = !ioConfig.Development
@@ -268,5 +268,5 @@ func BuildSite(ioConfig *IOConfig, cfg *config.Config) (*Result, error) {
 	templates.Setup()
 	loadCSS(ioConfig.Source)
 
-	return build(ioConfig, cfg)
+	return build(ioConfig, cfg, log)
 }
diff --git a/internal/config/config.go b/internal/config/config.go
index 5e568cd..42e36d7 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -51,7 +51,7 @@ type Config struct {
 	Menus map[string][]MenuItem
 }
 
-func GetConfig(dir string) (*Config, error) {
+func GetConfig(dir string, log *log.Logger) (*Config, error) {
 	config := Config{}
 	filename := filepath.Join(dir, "config.toml")
 	log.Debug("reading config", "filename", filename)
diff --git a/internal/content/posts.go b/internal/content/posts.go
index 000cd98..dd14d1e 100644
--- a/internal/content/posts.go
+++ b/internal/content/posts.go
@@ -13,11 +13,11 @@ import (
 
 	"github.com/adrg/frontmatter"
 	mapset "github.com/deckarep/golang-set/v2"
-	"gitlab.com/tozd/go/errors"
 	fences "github.com/stefanfritsch/goldmark-fences"
 	"github.com/yuin/goldmark"
 	"github.com/yuin/goldmark/extension"
 	htmlrenderer "github.com/yuin/goldmark/renderer/html"
+	"gitlab.com/tozd/go/errors"
 )
 
 type PostMatter struct {
@@ -80,16 +80,22 @@ func RenderMarkdown(content []byte) (string, error) {
 	return buf.String(), nil
 }
 
-func ReadPosts(root string, inputDir string, outputDir string) ([]Post, Tags, error) {
+type Config struct {
+	Root      string
+	InputDir  string
+	OutputDir string
+}
+
+func ReadPosts(config *Config, log *log.Logger) ([]Post, Tags, error) {
 	tags := mapset.NewSet[string]()
 	posts := []Post{}
-	subdir := filepath.Join(root, inputDir)
+	subdir := filepath.Join(config.Root, config.InputDir)
 	files, err := os.ReadDir(subdir)
 	if err != nil {
 		return nil, nil, errors.WithMessagef(err, "could not read post directory %s", subdir)
 	}
-	outputReplacer := strings.NewReplacer(root, outputDir, ".md", "/index.html")
-	urlReplacer := strings.NewReplacer(root, "", ".md", "/")
+	outputReplacer := strings.NewReplacer(config.Root, config.OutputDir, ".md", "/index.html")
+	urlReplacer := strings.NewReplacer(config.Root, "", ".md", "/")
 	for _, f := range files {
 		pathFromRoot := filepath.Join(subdir, f.Name())
 		if !f.IsDir() && path.Ext(pathFromRoot) == ".md" {
diff --git a/internal/listenfd/listenfd.go b/internal/listenfd/listenfd.go
index 4e8c007..8c723eb 100644
--- a/internal/listenfd/listenfd.go
+++ b/internal/listenfd/listenfd.go
@@ -13,7 +13,7 @@ import (
 
 const fdStart = 3
 
-func GetListener(i uint64, addr string) (l net.Listener, err error) {
+func GetListener(i uint64, addr string, log *log.Logger) (l net.Listener, err error) {
 	l, err = getFDSocket(i)
 	if err != nil {
 		log.Warn("could not create listener from listenfd", "error", err)
@@ -30,8 +30,13 @@ func GetListener(i uint64, addr string) (l net.Listener, err error) {
 	return
 }
 
-func GetListenerTLS(i uint64, addr string, config *tls.Config) (l net.Listener, err error) {
-	l, err = GetListener(i, addr)
+func GetListenerTLS(
+	i uint64,
+	addr string,
+	config *tls.Config,
+	log *log.Logger,
+) (l net.Listener, err error) {
+	l, err = GetListener(i, addr, log)
 	if err != nil {
 		return nil, err
 	}
diff --git a/internal/log/log.go b/internal/log/log.go
index a0f5ba7..f644e6b 100644
--- a/internal/log/log.go
+++ b/internal/log/log.go
@@ -7,30 +7,43 @@ import (
 	prettyconsole "github.com/thessem/zap-prettyconsole"
 	"go.uber.org/zap"
 	"go.uber.org/zap/zapcore"
+	"moul.io/zapfilter"
 )
 
-var logger *zap.SugaredLogger
+type Logger struct {
+	logger *zap.SugaredLogger
+}
 
-func DPanic(msg string, rest ...any) {
-	logger.DPanicw(msg, rest...)
+func (l Logger) DPanic(msg string, rest ...any) {
+	l.logger.DPanicw(msg, rest...)
 }
-func Debug(msg string, rest ...any) {
-	logger.Debugw(msg, rest...)
+func (l Logger) Debug(msg string, rest ...any) {
+	l.logger.Debugw(msg, rest...)
 }
-func Info(msg string, rest ...any) {
-	logger.Infow(msg, rest...)
+func (l Logger) Info(msg string, rest ...any) {
+	l.logger.Infow(msg, rest...)
 }
-func Warn(msg string, rest ...any) {
-	logger.Warnw(msg, rest...)
+func (l Logger) Warn(msg string, rest ...any) {
+	l.logger.Warnw(msg, rest...)
 }
-func Error(msg string, rest ...any) {
-	logger.Errorw(msg, rest...)
+func (l Logger) Error(msg string, rest ...any) {
+	l.logger.Errorw(msg, rest...)
 }
-func Panic(msg string, rest ...any) {
-	logger.Panicw(msg, rest...)
+func (l Logger) Panic(msg string, rest ...any) {
+	l.logger.Panicw(msg, rest...)
 }
-func Fatal(msg string, rest ...any) {
-	logger.Fatalw(msg, rest...)
+func (l Logger) Fatal(msg string, rest ...any) {
+	l.logger.Fatalw(msg, rest...)
+}
+
+func (l Logger) Named(name string) *Logger {
+	return &Logger{
+		logger: l.logger.Named(name),
+	}
+}
+
+func (l Logger) GetLogger() *zap.Logger {
+	return l.logger.Desugar()
 }
 
 func getLevelFromEnv() (zapcore.Level, error) {
@@ -43,7 +56,7 @@ func getLevelFromEnv() (zapcore.Level, error) {
 	return zap.InfoLevel, nil
 }
 
-func Configure(isProduction bool) {
+func Configure(isProduction bool) *Logger {
 	var l *zap.Logger
 	level, err := getLevelFromEnv()
 	if err != nil {
@@ -54,10 +67,21 @@ func Configure(isProduction bool) {
 		cfg.TimeKey = ""
 		l = zap.New(zapcore.NewCore(zaplogfmt.NewEncoder(cfg), os.Stderr, level))
 	} else {
-		cfg := prettyconsole.NewConfig()
-		cfg.EncoderConfig.TimeKey = ""
-		cfg.Level.SetLevel(level)
-		l = zap.Must(cfg.Build())
+		cfg := prettyconsole.NewEncoderConfig()
+		cfg.TimeKey = ""
+		var filter zapfilter.FilterFunc
+		if debug := os.Getenv("DEBUG"); debug != "" {
+			filter = zapfilter.Any(zapfilter.MinimumLevel(level), zapfilter.ByNamespaces(debug))
+		} else {
+			filter = zapfilter.MinimumLevel(level)
+		}
+		l = zap.New(zapfilter.NewFilteringCore(
+			zapcore.NewCore(prettyconsole.NewEncoder(cfg), os.Stderr, zap.DebugLevel),
+			filter,
+		))
+	}
+
+	return &Logger{
+		logger: l.WithOptions(zap.AddCallerSkip(1)).Sugar(),
 	}
-	logger = l.WithOptions(zap.AddCallerSkip(1)).Sugar()
 }
diff --git a/internal/server/dev.go b/internal/server/dev.go
index e83201a..4db9465 100644
--- a/internal/server/dev.go
+++ b/internal/server/dev.go
@@ -3,7 +3,6 @@ package server
 import (
 	"fmt"
 	"io/fs"
-	"log/slog"
 	"os"
 	"path"
 	"path/filepath"
@@ -21,6 +20,7 @@ type FileWatcher struct {
 }
 
 var (
+	l       *log.Logger
 	ignores = []string{
 		"*.templ",
 		"*.go",
@@ -32,7 +32,7 @@ func matches(name string) func(string) bool {
 	return func(pattern string) bool {
 		matched, err := path.Match(pattern, name)
 		if err != nil {
-			log.Warn("error checking watcher ignores", "error", err)
+			l.Warn("error checking watcher ignores", "error", err)
 		}
 
 		return matched
@@ -43,23 +43,24 @@ func ignored(pathname string) bool {
 	return slices.ContainsFunc(ignores, matches(path.Base(pathname)))
 }
 
-func NewFileWatcher() (*FileWatcher, error) {
+func NewFileWatcher(log *log.Logger) (*FileWatcher, error) {
 	watcher, err := fsnotify.NewWatcher()
 	if err != nil {
 		return nil, errors.WithMessage(err, "could not create watcher")
 	}
+	l = log
 
 	return &FileWatcher{watcher}, nil
 }
 
 func (watcher FileWatcher) AddRecursive(from string) error {
-	log.Debug("walking directory tree", "root", from)
+	l.Debug("walking directory tree", "root", from)
 	err := filepath.WalkDir(from, func(path string, entry fs.DirEntry, err error) error {
 		if err != nil {
 			return errors.WithMessagef(err, "could not walk directory %s", path)
 		}
 		if entry.IsDir() {
-			log.Debug("adding directory to watcher", "path", path)
+			l.Debug("adding directory to watcher", "path", path)
 			if err = watcher.Add(path); err != nil {
 				return errors.WithMessagef(err, "could not add directory %s to watcher", path)
 			}
@@ -77,17 +78,17 @@ func (watcher FileWatcher) Start(callback func(string)) {
 		select {
 		case event := <-watcher.Events:
 			if !ignored(event.Name) {
-				log.Debug("watcher event", "name", event.Name, "op", event.Op.String())
+				l.Debug("watcher event", "name", event.Name, "op", event.Op.String())
 				if event.Has(fsnotify.Create) || event.Has(fsnotify.Rename) {
 					f, err := os.Stat(event.Name)
 					if err != nil {
-						slog.Error(
+						l.Error(
 							fmt.Sprintf("error handling %s event: %v", event.Op.String(), err),
 						)
 					} else if f.IsDir() {
 						err = watcher.Add(event.Name)
 						if err != nil {
-							slog.Error(fmt.Sprintf("error adding new folder to watcher: %v", err))
+							l.Error(fmt.Sprintf("error adding new folder to watcher: %v", err))
 						}
 					}
 				}
@@ -102,7 +103,7 @@ func (watcher FileWatcher) Start(callback func(string)) {
 				}
 			}
 		case err := <-watcher.Errors:
-			slog.Error(fmt.Sprintf("error in watcher: %v", err))
+			l.Error("error in watcher", "error", err)
 		}
 	}
 }
diff --git a/internal/server/logging.go b/internal/server/logging.go
index 20f0a92..6393099 100644
--- a/internal/server/logging.go
+++ b/internal/server/logging.go
@@ -23,7 +23,7 @@ func NewLoggingResponseWriter(w http.ResponseWriter) *LoggingResponseWriter {
 	return &LoggingResponseWriter{w, http.StatusOK}
 }
 
-func wrapHandlerWithLogging(wrappedHandler http.Handler) http.Handler {
+func wrapHandlerWithLogging(wrappedHandler http.Handler, log *log.Logger) http.Handler {
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		lw := NewLoggingResponseWriter(w)
 		wrappedHandler.ServeHTTP(lw, r)
diff --git a/internal/server/mime.go b/internal/server/mime.go
index 3a1ec8a..340e4c5 100644
--- a/internal/server/mime.go
+++ b/internal/server/mime.go
@@ -10,14 +10,10 @@ var newMIMEs = map[string]string{
 	".xsl": "text/xsl",
 }
 
-func fixupMIMETypes() {
+func fixupMIMETypes(log *log.Logger) {
 	for ext, newType := range newMIMEs {
 		if err := mime.AddExtensionType(ext, newType); err != nil {
 			log.Error("could not update mime type", "ext", ext, "mime", newType)
 		}
 	}
 }
-
-func init() {
-	fixupMIMETypes()
-}
diff --git a/internal/server/server.go b/internal/server/server.go
index dfb0f8c..f01f939 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -49,6 +49,7 @@ type Server struct {
 	redirectServer *http.Server
 	runtimeConfig  *Config
 	config         *cfg.Config
+	log            *log.Logger
 }
 
 func applyDevModeOverrides(config *cfg.Config, runtimeConfig *Config) {
@@ -87,8 +88,8 @@ func serverHeaderHandler(wrappedHandler http.Handler) http.Handler {
 	})
 }
 
-func rebuild(builderConfig *builder.IOConfig, config *cfg.Config) error {
-	r, err := builder.BuildSite(builderConfig, config)
+func rebuild(builderConfig *builder.IOConfig, config *cfg.Config, log *log.Logger) error {
+	r, err := builder.BuildSite(builderConfig, config, log.Named("builder"))
 	if err != nil {
 		return errors.WithMessage(err, "could not build site")
 	}
@@ -97,7 +98,7 @@ func rebuild(builderConfig *builder.IOConfig, config *cfg.Config) error {
 	return nil
 }
 
-func New(runtimeConfig *Config) (*Server, error) {
+func New(runtimeConfig *Config, log *log.Logger) (*Server, error) {
 	builderConfig := &builder.IOConfig{
 		Destination: runtimeConfig.Root,
 		Development: runtimeConfig.Development,
@@ -109,7 +110,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 		if err != nil {
 			return nil, err
 		}
-		_, err = vcs.CloneOrUpdate(vcsConfig)
+		_, err = vcs.CloneOrUpdate(vcsConfig, log.Named("vcs"))
 		if err != nil {
 			return nil, err
 		}
@@ -125,7 +126,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 		runtimeConfig.Root = publicDir
 	}
 
-	config, err := cfg.GetConfig(builderConfig.Source)
+	config, err := cfg.GetConfig(builderConfig.Source, log.Named("config"))
 	if err != nil {
 		return nil, errors.WithMessage(err, "error parsing configuration file")
 	}
@@ -136,16 +137,18 @@ func New(runtimeConfig *Config) (*Server, error) {
 	listenAddress := net.JoinHostPort(runtimeConfig.ListenAddress, strconv.Itoa(runtimeConfig.Port))
 	top := http.NewServeMux()
 
-	err = rebuild(builderConfig, config)
+	err = rebuild(builderConfig, config, log)
 	if err != nil {
 		return nil, err
 	}
 
+	fixupMIMETypes(log)
+
 	if runtimeConfig.Development {
 		liveReload := livereload.New()
 		top.Handle("/_/reload", liveReload)
 		liveReload.Start()
-		fw, err := NewFileWatcher()
+		fw, err := NewFileWatcher(log.Named("watcher"))
 		if err != nil {
 			return nil, errors.WithMessage(err, "could not create file watcher")
 		}
@@ -165,7 +168,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 		}
 		go fw.Start(func(filename string) {
 			log.Info("rebuilding site", "changed_file", filename)
-			err := rebuild(builderConfig, config)
+			err := rebuild(builderConfig, config, log)
 			if err != nil {
 				log.Error("error rebuilding site", "error", err)
 			}
@@ -173,7 +176,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 	}
 
 	loggingMux := http.NewServeMux()
-	mux, err := website.NewMux(config, runtimeConfig.Root)
+	mux, err := website.NewMux(config, runtimeConfig.Root, log.Named("website"))
 	if err != nil {
 		return nil, errors.Wrap(err, "could not create website mux")
 	}
@@ -193,7 +196,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 
 	top.Handle("/",
 		serverHeaderHandler(
-			wrapHandlerWithLogging(loggingMux),
+			wrapHandlerWithLogging(loggingMux, log),
 		),
 	)
 
@@ -218,6 +221,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 			Addr:              listenAddress,
 			Handler:           rMux,
 		},
+		log:           log,
 		config:        config,
 		runtimeConfig: runtimeConfig,
 	}, nil
@@ -240,19 +244,19 @@ func (s *Server) Start() error {
 }
 
 func (s *Server) Stop() chan struct{} {
-	log.Debug("stop called")
+	s.log.Debug("stop called")
 
 	idleConnsClosed := make(chan struct{})
 
 	go func() {
-		log.Debug("shutting down server")
+		s.log.Debug("shutting down server")
 		ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
 		defer cancel()
 		err := s.Server.Shutdown(ctx)
-		log.Debug("server shut down")
+		s.log.Debug("server shut down")
 		if err != nil {
 			// Error from closing listeners, or context timeout:
-			log.Warn("HTTP server Shutdown", "error", err)
+			s.log.Warn("HTTP server Shutdown", "error", err)
 		}
 		close(idleConnsClosed)
 	}()
diff --git a/internal/server/tcp.go b/internal/server/tcp.go
index 4efde7d..12fdeb2 100644
--- a/internal/server/tcp.go
+++ b/internal/server/tcp.go
@@ -5,7 +5,7 @@ import (
 )
 
 func (s *Server) serveTCP() error {
-	l, err := listenfd.GetListener(0, s.Addr)
+	l, err := listenfd.GetListener(0, s.Addr, s.log.Named("tcp.listenfd"))
 	if err != nil {
 		return err
 	}
diff --git a/internal/server/tls.go b/internal/server/tls.go
index 6c48f86..655455c 100644
--- a/internal/server/tls.go
+++ b/internal/server/tls.go
@@ -8,7 +8,6 @@ import (
 	"strconv"
 
 	"go.alanpearce.eu/website/internal/listenfd"
-	"go.alanpearce.eu/website/internal/log"
 
 	"github.com/ardanlabs/conf/v3"
 	"github.com/caddyserver/caddy/v2"
@@ -27,10 +26,10 @@ type redisConfig struct {
 
 func (s *Server) serveTLS() (err error) {
 	var issuer *certmagic.ACMEIssuer
+	log := s.log.Named("tls")
 
 	// setting cfg.Logger is too late somehow
-	certmagic.Default.Logger = log.GetLogger().
-		Named("certmagic")
+	certmagic.Default.Logger = log.GetLogger().Named("certmagic")
 	cfg := certmagic.NewDefault()
 	cfg.DefaultServerName = s.config.Domains[0]
 
@@ -97,6 +96,7 @@ func (s *Server) serveTLS() (err error) {
 	ln, err := listenfd.GetListener(
 		1,
 		net.JoinHostPort(s.runtimeConfig.ListenAddress, strconv.Itoa(s.runtimeConfig.Port)),
+		log.Named("listenfd"),
 	)
 	if err != nil {
 		return errors.Wrap(err, "could not bind plain socket")
@@ -127,6 +127,7 @@ func (s *Server) serveTLS() (err error) {
 		0,
 		net.JoinHostPort(s.runtimeConfig.ListenAddress, strconv.Itoa(s.runtimeConfig.TLSPort)),
 		tlsConfig,
+		log.Named("listenfd"),
 	)
 	if err != nil {
 		return errors.Wrap(err, "could not bind tls socket")
diff --git a/internal/vcs/repository.go b/internal/vcs/repository.go
index 1dbf783..017b3d8 100644
--- a/internal/vcs/repository.go
+++ b/internal/vcs/repository.go
@@ -18,9 +18,10 @@ type Config struct {
 
 type Repository struct {
 	repo *git.Repository
+	log  *log.Logger
 }
 
-func CloneOrUpdate(cfg *Config) (*Repository, error) {
+func CloneOrUpdate(cfg *Config, log *log.Logger) (*Repository, error) {
 	gr, err := git.PlainClone(cfg.LocalPath, false, &git.CloneOptions{
 		URL:      cfg.RemoteURL.String(),
 		Progress: os.Stdout,
@@ -35,6 +36,7 @@ func CloneOrUpdate(cfg *Config) (*Repository, error) {
 		}
 		repo := &Repository{
 			repo: gr,
+			log:  log,
 		}
 		_, err := repo.Update()
 		if err != nil {
@@ -46,18 +48,19 @@ func CloneOrUpdate(cfg *Config) (*Repository, error) {
 
 	return &Repository{
 		repo: gr,
+		log:  log,
 	}, nil
 }
 
 func (r *Repository) Update() (bool, error) {
-	log.Info("updating repository")
+	r.log.Info("updating repository")
 
 	head, err := r.repo.Head()
 	if err != nil {
 		return false, err
 	}
 
-	log.Info("updating from", "rev", head.Hash().String())
+	r.log.Info("updating from", "rev", head.Hash().String())
 	wt, err := r.repo.Worktree()
 	if err != nil {
 		return false, err
@@ -68,7 +71,7 @@ func (r *Repository) Update() (bool, error) {
 	})
 	if err != nil {
 		if errors.Is(err, git.NoErrAlreadyUpToDate) {
-			log.Info("already up-to-date")
+			r.log.Info("already up-to-date")
 
 			return true, nil
 		}
@@ -80,7 +83,7 @@ func (r *Repository) Update() (bool, error) {
 	if err != nil {
 		return false, err
 	}
-	log.Info("updated to", "rev", head.Hash().String())
+	r.log.Info("updated to", "rev", head.Hash().String())
 
 	return true, r.Clean(wt)
 }
diff --git a/internal/website/filemap.go b/internal/website/filemap.go
index 21cd28a..f9ce462 100644
--- a/internal/website/filemap.go
+++ b/internal/website/filemap.go
@@ -79,7 +79,7 @@ func registerFile(urlpath string, fp string) error {
 	return nil
 }
 
-func registerContentFiles(root string) error {
+func registerContentFiles(root string, log *log.Logger) error {
 	err := filepath.WalkDir(root, func(filePath string, f fs.DirEntry, err error) error {
 		if err != nil {
 			return errors.WithMessagef(err, "failed to access path %s", filePath)
diff --git a/internal/website/mux.go b/internal/website/mux.go
index c6992df..ebdf2d0 100644
--- a/internal/website/mux.go
+++ b/internal/website/mux.go
@@ -31,12 +31,14 @@ type webHandler func(http.ResponseWriter, *http.Request) *ihttp.Error
 type WrappedWebHandler struct {
 	config  *config.Config
 	handler webHandler
+	log     *log.Logger
 }
 
-func wrapHandler(cfg *config.Config, webHandler webHandler) WrappedWebHandler {
+func wrapHandler(cfg *config.Config, webHandler webHandler, log *log.Logger) WrappedWebHandler {
 	return WrappedWebHandler{
 		config:  cfg,
 		handler: webHandler,
+		log:     log,
 	}
 }
 
@@ -44,7 +46,7 @@ func (fn WrappedWebHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	defer func() {
 		if fail := recover(); fail != nil {
 			w.WriteHeader(http.StatusInternalServerError)
-			log.Error("runtime panic!", "error", fail)
+			fn.log.Error("runtime panic!", "error", fail)
 		}
 	}()
 	if err := fn.handler(w, r); err != nil {
@@ -60,11 +62,11 @@ func (fn WrappedWebHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	}
 }
 
-func NewMux(cfg *config.Config, root string) (mux *http.ServeMux, err error) {
+func NewMux(cfg *config.Config, root string, log *log.Logger) (mux *http.ServeMux, err error) {
 	mux = &http.ServeMux{}
 
 	log.Debug("registering content files", "root", root)
-	err = registerContentFiles(root)
+	err = registerContentFiles(root, log)
 	if err != nil {
 		return nil, errors.WithMessagef(err, "registering content files")
 	}
@@ -99,7 +101,7 @@ func NewMux(cfg *config.Config, root string) (mux *http.ServeMux, err error) {
 		http.ServeFile(w, r, files[urlPath].alternatives[enc])
 
 		return nil
-	}))
+	}, log))
 
 	var acctResource = "acct:" + cfg.Email
 	me := digit.NewResource(acctResource).