View Source Grizzly.Trace (grizzly v6.7.0)

Module that tracks the commands that are sent and received by Grizzly

The trace will hold in memory the last 300 messages. If you want to generate a log file of the trace records you use Grizzly.Trace.dump/1.

The log format is:

timestamp source destination sequence_number command_name command_parameters

If you want to list the records that are currently being held in memory you can use Grizzly.Trace.list/0.

If you want to start traces from a fresh start you can call Grizzly.Trace.clear/0.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Force clear the records from the trace

Dump the trace records into a file. See format/2 for the available formats.

Serializes a list of trace records into a binary. The format can be one of

List all the records currently being traced

Log the trace information

Start the trace server

Link to this section Types

@type dest() :: String.t()
@type format() :: :text | :term
@type log_opt() :: {:src, src()} | {:dest, dest()}
@type src() :: String.t()

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec clear() :: :ok

Force clear the records from the trace

Link to this function

dump(file, format \\ :text)

View Source
@spec dump(binary(), format()) :: :ok | {:error, atom()}

Dump the trace records into a file. See format/2 for the available formats.

Link to this function

format(records, format \\ :text)

View Source
@spec format([Grizzly.Trace.Record.t()], format()) :: binary()

Serializes a list of trace records into a binary. The format can be one of:

  • :text - Each record is on a new line and is formatted as timestamp source destination sequence_number command_name command_parameters. This is the default format.

  • :term - The trace is serialized as a list of Record.t() structs in Erlang external term format. This is useful if you want to load the trace on another machine.

@spec list() :: [Grizzly.Trace.Record.t()]

List all the records currently being traced

@spec log(binary(), [log_opt()]) :: :ok

Log the trace information

@spec start_link(keyword()) :: GenServer.on_start()

Start the trace server