View Source Grizzly.Trace (grizzly v7.4.2)
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
.
Summary
Functions
Returns a specification to start this module under a supervisor.
Reset the trace buffer.
Dump trace records into a file. See format/2
for the available formats.
Serialize a list of trace records into a binary. The format can be one of
List all records in the trace buffer.
Add a record to the trace buffer.
Write trace records to standard out. See format/2
for the available formats.
Enable or disable logging of keepalive frames.
Change the max size of the trace buffer from the default of 300.
Start the trace server
Types
@type dest() :: String.t()
@type format() :: :text | :term
@type src() :: String.t()
@type trace_opt() :: {:name, atom()} | {:size, pos_integer()} | {:record_keepalives, boolean()}
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec clear(GenServer.name()) :: :ok
Reset the trace buffer.
Dump trace records into a file. See format/2
for the available formats.
@spec format([Grizzly.Trace.Record.t()], format()) :: binary()
Serialize 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 astimestamp source destination sequence_number command_name command_binary
. This is the default format.:raw
- Each record is on a new line and is formatted astimestamp source -> destination: binary
.:term
- The trace is serialized as a list ofRecord.t()
structs in Erlang external term format. This is useful if you want to load the trace on another machine.
@spec list(GenServer.name()) :: [Grizzly.Trace.Record.t()]
List all records in the trace buffer.
See log/3
@spec log(GenServer.name(), binary(), [log_opt()]) :: :ok
Add a record to the trace buffer.
@spec print() :: :ok
@spec print([Grizzly.Trace.Record.t()] | format()) :: :ok
@spec print([Grizzly.Trace.Record.t()], format()) :: :ok
Write trace records to standard out. See format/2
for the available formats.
@spec record_keepalives(GenServer.name(), boolean()) :: :ok
Enable or disable logging of keepalive frames.
@spec resize(GenServer.name(), pos_integer()) :: :ok
Change the max size of the trace buffer from the default of 300.
@spec start_link([trace_opt()]) :: GenServer.on_start()
Start the trace server