@marcel91200 / caddy Mirror · read-only / commits / c4c45f8e
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

logging: Tweak defaults (enable logging by default, color level enc.)

Matthew Holt committed Oct 29, 2019 at 11:58 UTC c4c45f8e01bd59b556eaa84f4d6c6ec529e01acb
2 files changed +7 -5
caddy.go
+6 -5
@@ -119,11 +119,12 @@ func run(newCfg *Config, start bool) error {
119 newCfg.cancelFunc = cancel // clean up later
120
121 // set up logging before anything bad happens
122 - if newCfg.Logging != nil {
123 - err := newCfg.Logging.openLogs(ctx)
124 - if err != nil {
125 - return err
126 - }
122 + if newCfg.Logging == nil {
123 + newCfg.Logging = new(Logging)
124 + }
125 + err = newCfg.Logging.openLogs(ctx)
126 + if err != nil {
127 + return err
128 }
129
130 // set up global storage and make it CertMagic's default storage, too
logging.go
+1
@@ -577,6 +577,7 @@ func newDefaultProductionLog() (*defaultCustomLog, error) {
577 return nil, err
578 }
579 encCfg := zap.NewProductionEncoderConfig()
580 + encCfg.EncodeLevel = zapcore.CapitalColorLevelEncoder
581 cl.encoder = zapcore.NewConsoleEncoder(encCfg)
582 cl.levelEnabler = zapcore.InfoLevel
583