summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/server.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index 461865c..c7780b0 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -172,7 +172,12 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
logger := accLog
if s.Logs != nil && s.Logs.LoggerNames != nil {
- logger = logger.Named(s.Logs.LoggerNames[r.Host])
+ if loggerName, ok := s.Logs.LoggerNames[r.Host]; ok {
+ logger = logger.Named(loggerName)
+ } else {
+ // see if there's a default log name to attach to
+ logger = logger.Named(s.Logs.LoggerNames[""])
+ }
}
log := logger.Info