Update uart_handler
@@ -30,9 +30,9 @@ All text above must be included in any redistribution.
# logger.level = logging.INFO
# logger.info('testing')
-from adafruit_logging import LoggingHandler
+from adafruit_logging import Handler
-class UartHandler(LoggingHandler):
+class UartHandler(Handler):
"""Send logging output to a serial port."""
def __init__(self, uart):
@@ -43,20 +43,16 @@ class UartHandler(LoggingHandler):
"""
self._uart = uart
- def format(self, level, msg):
+ def format(self, record):
"""Generate a string to log.
- :param level: The level at which to log
- :param msg: The core message
-
+ :param record: The record (message object) to be logged
"""
- return super().format(level, msg) + '\r\n'
+ return super().format(record) + '\r\n'
- def emit(self, level, msg):
+ def emit(self, record):
"""Generate the message and write it to the UART.
- :param level: The level at which to log
- :param msg: The core message
-
+ :param record: The record (message object) to be logged
"""
- self._uart.write(bytes(self.format(level, msg), 'utf-8'))
+ self._uart.write(bytes(self.format(record), 'utf-8'))
