| 133 | } |
| 134 | |
| 135 | func (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 | |
| 157 | func (slc *ServerLogConfig) clone() *ServerLogConfig { |
| 158 | clone := &ServerLogConfig{ |