macula_console (macula v0.20.5)

View Source

Macula Console Formatter - Beautiful colored terminal output.

Provides ANSI-colored output for ping-pong demo and general logging. Makes demo output visually appealing and easy to read.

Example output:

   --> fc01 -> rc05 [full_cone -> restricted]
   <-- fc01 <- rc05 42ms [restricted]
   [!!] fc01 -> sy07 TIMEOUT [symmetric]
   

Summary

Functions

Display a startup banner for the node

Output an error message: [!!] Error message

Output an info message: [i] Info message

Output a node connected event: [*] Node fc01 connected (full_cone)

Output a node disconnected event: [*] Node fc01 disconnected

Output a PING message showing source to target with NAT types

Output a PONG message with RTT

Output a PubSub receive message with delivery rate

Output a PubSub broadcast message with sequence number

Output statistics for a node StatsMap should contain: pings_sent, pongs_received, timeouts, avg_rtt_ms

Output a success message: [ok] Success message

Output a TIMEOUT message for a failed ping

Output a warning message: [!] Warning message

Functions

banner(Config)

-spec banner(map()) -> ok.

Display a startup banner for the node

error(Prefix, Msg)

-spec error(binary() | string(), binary() | string()) -> ok.

Output an error message: [!!] Error message

info(Prefix, Msg)

-spec info(binary() | string(), binary() | string()) -> ok.

Output an info message: [i] Info message

node_connected(NodeId, NatType)

-spec node_connected(binary() | string(), binary() | string() | atom()) -> ok.

Output a node connected event: [*] Node fc01 connected (full_cone)

node_disconnected(NodeId, Reason)

-spec node_disconnected(binary() | string(), binary() | string()) -> ok.

Output a node disconnected event: [*] Node fc01 disconnected

ping(FromNode, ToNode, FromNat, ToNat)

-spec ping(binary() | string(),
           binary() | string(),
           binary() | string() | atom(),
           binary() | string() | atom()) ->
              ok.

Output a PING message showing source to target with NAT types

pong(FromNode, ToNode, RTT, NatType)

-spec pong(binary() | string(), binary() | string(), integer(), binary() | string() | atom()) -> ok.

Output a PONG message with RTT

pubsub_recv(ToNode, FromNode, SeqNum, SenderNat, DeliveryRate)

-spec pubsub_recv(binary() | string(),
                  binary() | string(),
                  integer(),
                  binary() | string() | atom(),
                  float()) ->
                     ok.

Output a PubSub receive message with delivery rate

pubsub_send(FromNode, SeqNum, NatType)

-spec pubsub_send(binary() | string(), integer(), binary() | string() | atom()) -> ok.

Output a PubSub broadcast message with sequence number

stats(NodeId, StatsMap)

-spec stats(binary() | string(), map()) -> ok.

Output statistics for a node StatsMap should contain: pings_sent, pongs_received, timeouts, avg_rtt_ms

success(Prefix, Msg)

-spec success(binary() | string(), binary() | string()) -> ok.

Output a success message: [ok] Success message

timeout(FromNode, ToNode, NatInfo)

-spec timeout(binary() | string(), binary() | string(), binary() | string() | atom()) -> ok.

Output a TIMEOUT message for a failed ping

warning(Prefix, Msg)

-spec warning(binary() | string(), binary() | string()) -> ok.

Output a warning message: [!] Warning message