SMPPEX.Pdu.PP (smppex v3.0.4) View Source

Module for colored pretty printing Pdu structs.

Link to this section Summary

Functions

Forms an iolist containing colored Pdu dump.

Link to this section Functions

Link to this function

format(pdu, indent \\ " ", pad \\ "")

View Source

Specs

format(pdu :: SMPPEX.Pdu.t(), indent :: String.t(), pad :: String.t()) ::
  iolist()

Forms an iolist containing colored Pdu dump.

indent is the string prepended to each line of the dump (" " by default). pad is the string prepended to nested lines of the dump together with indent. The default is "".

Example

iex> pdu = SMPPEX.Pdu.Factory.submit_sm({"from", 1, 1}, {"to", 1, 1}, "hello")

Then pdu |> SMPPEX.Pdu.PP.format |> IO.puts will print:

pdu: submit_sm
  command_id: 4
  command_status: 0 (ok)
  sequence_number: 0
mandatory fields:
  dest_addr_npi: 1
  dest_addr_ton: 1
  destination_addr: "to"
  registered_delivery: 0
  short_message: "hello"
  source_addr: "from"
  source_addr_npi: 1
  source_addr_ton: 1
optional fields: []