Search documentation of macula

# macula_console (macula v4.4.1)

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

banner(Config)

Display a startup banner for the node

error(Prefix, Msg)

Output an error message: [!!] Error message

info(Prefix, Msg)

Output an info message: [i] Info message

node_connected(NodeId, NatType)

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

node_disconnected(NodeId, Reason)

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

ping(FromNode, ToNode, FromNat, ToNat)

Output a PING message showing source to target with NAT types

pong(FromNode, ToNode, RTT, NatType)

Output a PONG message with RTT

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

Output a PubSub receive message with delivery rate

pubsub_send(FromNode, SeqNum, NatType)

Output a PubSub broadcast message with sequence number

stats(NodeId, StatsMap)

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

success(Prefix, Msg)

Output a success message: [ok] Success message

timeout(FromNode, ToNode, NatInfo)

Output a TIMEOUT message for a failed ping

warning(Prefix, Msg)

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