adafruit_logging¶
Logging module for CircuitPython
- Author(s): Dave Astels
Implementation Notes¶
Hardware:
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
-
class
adafruit_logging.Logger¶ Provide a logging api.
-
addHandler(hldr)¶ Sets the handler of this logger to the specified handler. NOTE this is slightly different from the CPython equivalent which adds the handler rather than replaceing it.
Parameters: hldr – the handler
-
critical(format_string, *args)¶ Log a critical message.
Parameters: - format_string – the core message string with embedded formatting directives
- args – arguments to
format_string.format(), can be empty
-
debug(format_string, *args)¶ Log a debug message.
Parameters: - format_string – the core message string with embedded formatting directives
- args – arguments to
format_string.format(), can be empty
-
error(format_string, *args)¶ Log a error message.
Parameters: - format_string – the core message string with embedded formatting directives
- args – arguments to
format_string.format(), can be empty
-
getEffectiveLevel()¶ Get the effective level for this logger.
Returns: the lowest level to output
-
info(format_string, *args)¶ Log a info message.
Parameters: - format_string – the core message string with embedded formatting directives
- args – arguments to
format_string.format(), can be empty
-
log(level, format_string, *args)¶ Log a message.
Parameters: - level – the priority level at which to log
- format_string – the core message string with embedded formatting directives
- args – arguments to
format_string.format(), can be empty
-
setLevel(value)¶ Set the logging cuttoff level.
Parameters: value – the lowest level to output
-
warning(format_string, *args)¶ Log a warning message.
Parameters: - format_string – the core message string with embedded formatting directives
- args – arguments to
format_string.format(), can be empty
-
-
class
adafruit_logging.LoggingHandler¶ Abstract logging message handler.
-
emit(level, msg)¶ Send a message where it should go. Place holder for subclass implementations.
-
format(level, msg)¶ Generate a timestamped message.
Parameters: - level – the logging level
- msg – the message to log
-
-
class
adafruit_logging.NullLogger¶ Provide an empty logger. This can be used in place of a real logger to more efficiently disable logging.
-
addHandler(hldr)¶ Dummy implementation.
-
critical(format_string, *args)¶ Dummy implementation.
-
debug(format_string, *args)¶ Dummy implementation.
-
error(format_string, *args)¶ Dummy implementation.
-
getEffectiveLevel()¶ Dummy implementation.
-
info(format_string, *args)¶ Dummy implementation.
-
log(level, format_string, *args)¶ Dummy implementation.
-
setLevel(value)¶ Dummy implementation.
-
warning(format_string, *args)¶ Dummy implementation.
-
-
class
adafruit_logging.PrintHandler¶ Send logging messages to the console by using print.
-
emit(level, msg)¶ Send a message to teh console.
Parameters: - level – the logging level
- msg – the message to log
-
-
adafruit_logging.getLogger(name)¶ Create or retrieve a logger by name.
Parameters: name – the name of the logger to create/retrieve None will cause the NullLogger instance to be returned.
-
adafruit_logging.level_for(value)¶ Convert a numberic level to the most appropriate name.
Parameters: value – a numeric level