Browse Source
logging: Tweak defaults (enable logging by default, color level enc.)
master
Matthew Holt
5 years ago
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
2 changed files with
7 additions and
5 deletions
-
caddy.go
-
logging.go
|
|
@ -119,11 +119,12 @@ func run(newCfg *Config, start bool) error { |
|
|
|
newCfg.cancelFunc = cancel // clean up later
|
|
|
|
|
|
|
|
// set up logging before anything bad happens
|
|
|
|
if newCfg.Logging != nil { |
|
|
|
err := newCfg.Logging.openLogs(ctx) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
if newCfg.Logging == nil { |
|
|
|
newCfg.Logging = new(Logging) |
|
|
|
} |
|
|
|
err = newCfg.Logging.openLogs(ctx) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
// set up global storage and make it CertMagic's default storage, too
|
|
|
|
|
|
@ -577,6 +577,7 @@ func newDefaultProductionLog() (*defaultCustomLog, error) { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
encCfg := zap.NewProductionEncoderConfig() |
|
|
|
encCfg.EncodeLevel = zapcore.CapitalColorLevelEncoder |
|
|
|
cl.encoder = zapcore.NewConsoleEncoder(encCfg) |
|
|
|
cl.levelEnabler = zapcore.InfoLevel |
|
|
|
|
|
|
|