MCPcopy
hub / github.com/rs/zerolog / decodeOutput

Function decodeOutput

slog_test.go:23–29  ·  view source on GitHub ↗

decodeOutput converts the buffer contents to a JSON string, handling CBOR-encoded output when built with the binary_log tag.

(buf *bytes.Buffer)

Source from the content-addressed store, hash-verified

21// decodeOutput converts the buffer contents to a JSON string,
22// handling CBOR-encoded output when built with the binary_log tag.
23func decodeOutput(buf *bytes.Buffer) string {
24 p := buf.Bytes()
25 if len(p) == 0 || p[0] < 0x7F {
26 return buf.String()
27 }
28 return cbor.DecodeObjectToStr(p) + "\n"
29}
30
31func decodeJSON(t *testing.T, buf *bytes.Buffer) map[string]interface{} {
32 t.Helper()

Callers 2

decodeJSONFunction · 0.85

Calls 3

DecodeObjectToStrFunction · 0.92
BytesMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected