MCPcopy
hub / github.com/op/go-logging / SetFormatter

Function SetFormatter

format.go:132–136  ·  view source on GitHub ↗

SetFormatter sets the default formatter for all new backends. A backend will fetch this value once it is needed to format a record. Note that backends will cache the formatter after the first point. For now, make sure to set the formatter before logging.

(f Formatter)

Source from the content-addressed store, hash-verified

130// will cache the formatter after the first point. For now, make sure to set
131// the formatter before logging.
132func SetFormatter(f Formatter) {
133 formatter.Lock()
134 defer formatter.Unlock()
135 formatter.def = f
136}
137
138var formatRe = regexp.MustCompile(`%{([a-z]+)(?::(.*?[^\\]))?}`)
139

Callers 7

TestFormatFunction · 0.85
TestRealFuncFormatFunction · 0.85
TestStructFuncFormatFunction · 0.85
TestVarFuncFormatFunction · 0.85
TestLogCalldepthFunction · 0.85
testCallpathFunction · 0.85
ResetFunction · 0.85

Calls

no outgoing calls

Tested by 6

TestFormatFunction · 0.68
TestRealFuncFormatFunction · 0.68
TestStructFuncFormatFunction · 0.68
TestVarFuncFormatFunction · 0.68
TestLogCalldepthFunction · 0.68
testCallpathFunction · 0.68