p4utils.mininetlib.log module

This module is an extension of mininet.log that implements colored logs.

class p4utils.mininetlib.log.ColoredFormatter(fmt=None, datefmt=None, style='%', validate=True)[source]

Bases: logging.Formatter

Get colored logs.

format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

class p4utils.mininetlib.log.ShellBGColors[source]

Bases: object

Shell background colors.

black = '\x1b[40m'[source]
blue = '\x1b[44m'[source]
cyan = '\x1b[46m'[source]
darkgrey = '\x1b[100m'[source]
green = '\x1b[42m'[source]
lightblue = '\x1b[104m'[source]
lightcyan = '\x1b[106m'[source]
lightgreen = '\x1b[102m'[source]
lightgrey = '\x1b[47m'[source]
lightred = '\x1b[101m'[source]
orange = '\x1b[43m'[source]
pink = '\x1b[105m'[source]
purple = '\x1b[45m'[source]
red = '\x1b[41m'[source]
yellow = '\x1b[103m'[source]
class p4utils.mininetlib.log.ShellFGColors[source]

Bases: object

Shell foreground colors.

black = '\x1b[30m'[source]
blue = '\x1b[34m'[source]
cyan = '\x1b[36m'[source]
darkgrey = '\x1b[90m'[source]
green = '\x1b[32m'[source]
lightblue = '\x1b[94m'[source]
lightcyan = '\x1b[96m'[source]
lightgreen = '\x1b[92m'[source]
lightgrey = '\x1b[37m'[source]
lightred = '\x1b[91m'[source]
orange = '\x1b[33m'[source]
pink = '\x1b[95m'[source]
purple = '\x1b[35m'[source]
red = '\x1b[31m'[source]
yellow = '\x1b[93m'[source]
class p4utils.mininetlib.log.ShellStyles[source]

Bases: object

Shell styles.

bold = '\x1b[01m'[source]
disable = '\x1b[02m'[source]
invisible = '\x1b[08m'[source]
reset = '\x1b[0m'[source]
reverse = '\x1b[07m'[source]
strikethrough = '\x1b[09m'[source]
underline = '\x1b[04m'[source]
p4utils.mininetlib.log.excepthook(type, value, traceback)[source]