mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 14:13:48 +03:00
logging: Tweak defaults (enable logging by default, color level enc.)
This commit is contained in:
parent
54e458b756
commit
c4c45f8e01
2 changed files with 7 additions and 5 deletions
7
caddy.go
7
caddy.go
|
@ -119,12 +119,13 @@ func run(newCfg *Config, start bool) error {
|
||||||
newCfg.cancelFunc = cancel // clean up later
|
newCfg.cancelFunc = cancel // clean up later
|
||||||
|
|
||||||
// set up logging before anything bad happens
|
// set up logging before anything bad happens
|
||||||
if newCfg.Logging != nil {
|
if newCfg.Logging == nil {
|
||||||
err := newCfg.Logging.openLogs(ctx)
|
newCfg.Logging = new(Logging)
|
||||||
|
}
|
||||||
|
err = newCfg.Logging.openLogs(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// set up global storage and make it CertMagic's default storage, too
|
// set up global storage and make it CertMagic's default storage, too
|
||||||
err = func() error {
|
err = func() error {
|
||||||
|
|
|
@ -577,6 +577,7 @@ func newDefaultProductionLog() (*defaultCustomLog, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
encCfg := zap.NewProductionEncoderConfig()
|
encCfg := zap.NewProductionEncoderConfig()
|
||||||
|
encCfg.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||||
cl.encoder = zapcore.NewConsoleEncoder(encCfg)
|
cl.encoder = zapcore.NewConsoleEncoder(encCfg)
|
||||||
cl.levelEnabler = zapcore.InfoLevel
|
cl.levelEnabler = zapcore.InfoLevel
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue