I'm using Caddy as an embedded component in a service and would like to be able to set at least the default logger to the
zap logger the service has already configured by the time Caddy is started.
The primary reason for that is that setting up the logger in Caddy's config file is missing certain capabilities (primarily related to the encoder). But from management point of view, I want to avoid having to spread/duplicate logger configuration across multiple places (my service & Caddy config).
I guess the easiest place is to "extend" the Log function in logging.go. Being able to set the defaultLogger variable is most likely not going to work as it seems to be "recreated" in setupNewDefault based on its CustomLog settings - which lack what I need.
Or is there already a way to achieve that without any further code changes?
I'm using Caddy as an embedded component in a service and would like to be able to set at least the default logger to the
zap logger the service has already configured by the time Caddy is started.
The primary reason for that is that setting up the logger in Caddy's config file is missing certain capabilities (primarily related to the encoder). But from management point of view, I want to avoid having to spread/duplicate logger configuration across multiple places (my service & Caddy config).
I guess the easiest place is to "extend" the
Logfunction inlogging.go. Being able to set thedefaultLoggervariable is most likely not going to work as it seems to be "recreated" insetupNewDefaultbased on itsCustomLogsettings - which lack what I need.Or is there already a way to achieve that without any further code changes?