| 174 | } |
| 175 | |
| 176 | func (f *debugFilterSink) compile(res []string) error { |
| 177 | if len(res) == 0 { |
| 178 | return nil |
| 179 | } |
| 180 | |
| 181 | var reb strings.Builder |
| 182 | for i, re := range res { |
| 183 | _, _ = fmt.Fprintf(&reb, "(%s)", re) |
| 184 | if i != len(res)-1 { |
| 185 | _, _ = reb.WriteRune('|') |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | re, err := regexp.Compile(reb.String()) |
| 190 | if err != nil { |
| 191 | return xerrors.Errorf("compile regex: %w", err) |
| 192 | } |
| 193 | f.re = re |
| 194 | return nil |
| 195 | } |
| 196 | |
| 197 | func (f *debugFilterSink) LogEntry(ctx context.Context, ent slog.SinkEntry) { |
| 198 | if ent.Level == slog.LevelDebug { |