MCPcopy Create free account
hub / github.com/coder/coder / compile

Method compile

cli/clilog/clilog.go:176–195  ·  view source on GitHub ↗
(res []string)

Source from the content-addressed store, hash-verified

174}
175
176func (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
197func (f *debugFilterSink) LogEntry(ctx context.Context, ent slog.SinkEntry) {
198 if ent.Level == slog.LevelDebug {

Callers 1

BuildMethod · 0.95

Calls 3

CompileMethod · 0.80
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected