MCPcopy
hub / github.com/caddyserver/caddy / getLoggerHosts

Method getLoggerHosts

modules/caddyhttp/logging.go:135–155  ·  view source on GitHub ↗
(host string)

Source from the content-addressed store, hash-verified

133}
134
135func (slc ServerLogConfig) getLoggerHosts(host string) []string {
136 // try the exact hostname first
137 if hosts, ok := slc.LoggerNames[host]; ok {
138 return hosts
139 }
140
141 // try matching wildcard domains if other non-specific loggers exist
142 labels := strings.Split(host, ".")
143 for i := range labels {
144 if labels[i] == "" {
145 continue
146 }
147 labels[i] = "*"
148 wildcardHost := strings.Join(labels, ".")
149 if hosts, ok := slc.LoggerNames[wildcardHost]; ok {
150 return hosts
151 }
152 }
153
154 return []string{slc.DefaultLoggerName}
155}
156
157func (slc *ServerLogConfig) clone() *ServerLogConfig {
158 clone := &ServerLogConfig{

Callers 1

wrapLoggerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected