MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / InitReplacer

Function InitReplacer

log/log.go:93–105  ·  view source on GitHub ↗
(logMasks []config.LogMask)

Source from the content-addressed store, hash-verified

91var replacers []regexReplacer
92
93func InitReplacer(logMasks []config.LogMask) error {
94 for _, logMask := range logMasks {
95 re, err := regexp.Compile(logMask.Regex)
96 if err != nil {
97 return fmt.Errorf("error compiling regex %s: %w", logMask.Regex, err)
98 }
99 replacers = append(replacers, regexReplacer{
100 regex: re,
101 replacement: logMask.Replacement,
102 })
103 }
104 return nil
105}
106
107func mask(s string) string {
108 for _, r := range replacers {

Callers 2

mainFunction · 0.92
TestLogMaskFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestLogMaskFunction · 0.68