summaryrefslogtreecommitdiff
path: root/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'context.go')
-rw-r--r--context.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/context.go b/context.go
index c574be7..a6386aa 100644
--- a/context.go
+++ b/context.go
@@ -430,5 +430,13 @@ func (ctx Context) Storage() certmagic.Storage {
// Logger returns a logger that can be used by mod.
func (ctx Context) Logger(mod Module) *zap.Logger {
+ if ctx.cfg == nil {
+ // often the case in tests; just use a dev logger
+ l, err := zap.NewDevelopment()
+ if err != nil {
+ panic("config missing, unable to create dev logger: " + err.Error())
+ }
+ return l
+ }
return ctx.cfg.Logging.Logger(mod)
}