MCPcopy
hub / github.com/charmbracelet/log / TestFormatter

Function TestFormatter

pkg_test.go:217–226  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

215}
216
217func TestFormatter(t *testing.T) {
218 var buf bytes.Buffer
219 SetOutput(colorprofile.NewWriter(&buf, os.Environ()))
220 SetLevel(InfoLevel)
221 SetReportCaller(false)
222 SetReportTimestamp(false)
223 SetFormatter(JSONFormatter)
224 Info("info")
225 assert.Equal(t, "{\"level\":\"info\",\"msg\":\"info\"}\n", buf.String())
226}
227
228func TestWithPrefix(t *testing.T) {
229 l := WithPrefix("test")

Callers

nothing calls this directly

Calls 7

SetOutputFunction · 0.85
SetLevelFunction · 0.85
SetReportCallerFunction · 0.85
SetReportTimestampFunction · 0.85
SetFormatterFunction · 0.85
InfoFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…