mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-25 09:40:13 +08:00
core: Return default logger if no modules loaded
Fix report from: https://caddy.community/t/remote-caddyfile-invalid-memory-address-or-nil-pointer-dereference/19700/3
This commit is contained in:
parent
b301a3df70
commit
c6ac350a3b
|
@ -480,6 +480,9 @@ func (ctx Context) Logger(module ...Module) *zap.Logger {
|
||||||
if len(module) > 0 {
|
if len(module) > 0 {
|
||||||
mod = module[0]
|
mod = module[0]
|
||||||
}
|
}
|
||||||
|
if mod == nil {
|
||||||
|
return Log()
|
||||||
|
}
|
||||||
return ctx.cfg.Logging.Logger(mod)
|
return ctx.cfg.Logging.Logger(mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user