TraceGuard.Exporter.JSON (trace_guard v0.1.0)

Copy Markdown View Source

Encodes diagnostic reports as JSON using Jason.

Reports produced by TraceGuard.TraceBuilder contain only strings, numbers, booleans, nil, lists and string-keyed maps, and are redacted before they reach the exporter. Encoding therefore never needs custom Jason.Encoder implementations.

Summary

Functions

Encodes a report.

Encodes a report and writes it to path.

Functions

encode(report, opts \\ [])

@spec encode(map(), keyword()) :: {:ok, String.t()} | {:error, Exception.t()}

Encodes a report.

Options

  • :pretty - pretty-print the output (default false)

write(report, path, opts \\ [])

@spec write(map(), Path.t(), keyword()) :: :ok | {:error, term()}

Encodes a report and writes it to path.