|
Mininet Python API Reference Manual
|
Mininet-specific logger Enable each mininet .py file to with one. More...
Public Member Functions | |
| def | __init__ (self, name="mininet") |
| def | setLogLevel (self, levelname=None) |
| Setup loglevel. More... | |
| def | output (self, msg, *args, **kwargs) |
| Log 'msg % args' with severity 'OUTPUT'. More... | |
Public Attributes | |
| ch | |
Mininet-specific logger Enable each mininet .py file to with one.
| import | from mininet.log import [lg, info, error] |
...get a default logger that doesn't require one newline per logging call.
Inherit from object to ensure that we have at least one new-style base class, and can then use the metaclass directive, to prevent this
| error | |
| TypeError | Error when calling the metaclass bases a new-style class can't have only classic bases |
If Python2.5/logging/__init__.py defined Filterer as a new-style class, via Filterer( object ): rather than Filterer, we wouldn't need this.
Use singleton pattern to ensure only one logger is ever created.
| def mininet.log.MininetLogger.output | ( | self, | |
| msg, | |||
| * | args, | ||
| ** | kwargs | ||
| ) |
Log 'msg % args' with severity 'OUTPUT'.
To pass exception information, use the keyword argument exc_info
with a true value, e.g.
logger.warning("Houston, we have a %s", "cli output", exc_info=1)
| def mininet.log.MininetLogger.setLogLevel | ( | self, | |
levelname = None |
|||
| ) |
Setup loglevel.
Convenience function to support lowercase names.
| levelName | level name from LEVELS |
1.8.17