MCPcopy Create free account
hub / github.com/cockroachdb/redact / TestLogBody

Function TestLogBody

otelprocessor/processor_test.go:17–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15}
16
17func TestLogBody(t *testing.T) {
18 inBatch := plog.NewLogs()
19 rl := inBatch.ResourceLogs().AppendEmpty()
20 ils := rl.ScopeLogs().AppendEmpty()
21 library := ils.Scope()
22 library.SetName("first-library")
23
24 logEntry := ils.LogRecords().AppendEmpty()
25
26 body := redact.Sprintf("hello %s", "world")
27 logEntry.Body().SetStr(string(body))
28
29 ctx := context.Background()
30 processor := newRedactProcessor(ctx, &Config{})
31 outBatch, err := processor.processLogs(ctx, inBatch)
32 assert.NoError(t, err)
33 outLogBody := outBatch.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Body().Str()
34
35 require.Equal(t, string(body.Redact()), outLogBody)
36}

Callers

nothing calls this directly

Calls 4

SprintfFunction · 0.92
newRedactProcessorFunction · 0.85
processLogsMethod · 0.80
RedactMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…