serialhdl: Support prepending a warn_prefix to error and log messages

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-06-09 14:46:56 -04:00
parent f00281d1e6
commit 31fcd491fd
3 changed files with 55 additions and 41 deletions

View file

@ -415,7 +415,8 @@ class MCU:
if self._name.startswith('mcu '):
self._name = self._name[4:]
# Serial port
self._serial = serialhdl.SerialReader(self._reactor)
wp = "mcu '%s': " % (self._name)
self._serial = serialhdl.SerialReader(self._reactor, warn_prefix=wp)
self._baud = 0
self._canbus_iface = None
canbus_uuid = config.get('canbus_uuid', None)