server: improve add_warning method

Add an exc_info parameter that optionally takes an
exception that is passed to the logging function. This
will log the traceback without an additional logging call.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan
2024-05-27 08:19:04 -04:00
parent 11d15f96d1
commit 0ff1d79b5b
10 changed files with 25 additions and 24 deletions

View File

@@ -31,7 +31,7 @@ class ButtonManager:
btn = GpioButton(cfg)
except Exception as e:
msg = f"Failed to load button [{cfg.get_name()}]\n{e}"
self.server.add_warning(msg)
self.server.add_warning(msg, exc_info=e)
continue
self.buttons[btn.name] = btn
self.server.register_notification("button:button_event")