summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/caddyhttp.go6
-rw-r--r--modules/caddyhttp/responsewriter.go1
2 files changed, 6 insertions, 1 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index 36d8154..7830828 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -76,9 +76,13 @@ func (app *App) Provision(ctx caddy.Context) error {
for srvName, srv := range app.Servers {
srv.logger = app.logger.Named("log")
- srv.accessLogger = app.logger.Named("log.access")
srv.errorLogger = app.logger.Named("log.error")
+ // only enable access logs if configured
+ if srv.Logs != nil {
+ srv.accessLogger = app.logger.Named("log.access")
+ }
+
if srv.AutoHTTPS == nil {
// avoid nil pointer dereferences
srv.AutoHTTPS = new(AutoHTTPSConfig)
diff --git a/modules/caddyhttp/responsewriter.go b/modules/caddyhttp/responsewriter.go
index 5beb40e..dd16ce7 100644
--- a/modules/caddyhttp/responsewriter.go
+++ b/modules/caddyhttp/responsewriter.go
@@ -229,6 +229,7 @@ func (rr *responseRecorder) WriteResponse() error {
_, err := io.Copy(rr.ResponseWriterWrapper, rr.buf)
return err
}
+
// ResponseRecorder is a http.ResponseWriter that records
// responses instead of writing them to the client. See
// docs for NewResponseRecorder for proper usage.