MCPcopy
hub / github.com/crowdsecurity/crowdsec / FormatAlerts

Function FormatAlerts

pkg/csplugin/broker.go:494–508  ·  view source on GitHub ↗
(format string, alerts []*models.Alert)

Source from the content-addressed store, hash-verified

492}
493
494func FormatAlerts(format string, alerts []*models.Alert) (string, error) {
495 template, err := template.New("").Funcs(sprig.TxtFuncMap()).Funcs(funcMap).Parse(format)
496 if err != nil {
497 return "", err
498 }
499
500 b := new(strings.Builder)
501
502 err = template.Execute(b, alerts)
503 if err != nil {
504 return "", err
505 }
506
507 return b.String(), nil
508}

Callers 1

Calls 3

ParseMethod · 0.45
ExecuteMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…