Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 19:15 UTC
logging: Use `RedirectStdLog` to capture more stdlib logs (#4732)
* logging: Use `RedirectStdLog` * .gitignore a file pattern that I'm constantly using for testing
Francis Lavoie committed
Apr 28, 2022 at 10:42 UTC
3017b245c9275f910dff472ee5e7729625c4f913
2 files changed
+8
-1
.gitignore
+1
@@ -1,6 +1,7 @@
1
_gitignore/
2
*.log
3
Caddyfile
4
+Caddyfile.*
5
!caddyfile/
6
7
# artifacts from pprof tooling
logging.go
+7
-1
@@ -661,9 +661,15 @@ func newDefaultProductionLog() (*defaultCustomLog, error) {
661
662
cl.buildCore()
663
664
+ logger := zap.New(cl.core)
665
+
666
+ // capture logs from other libraries which
667
+ // may not be using zap logging directly
668
+ _ = zap.RedirectStdLog(logger)
669
+
670
return &defaultCustomLog{
671
CustomLog: cl,
666
- logger: zap.New(cl.core),
672
+ logger: logger,
673
}, nil
674
}
675