From cc094bb0710677a7e526146b691b05b85bad49fa Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 1 Jan 2023 22:03:17 -0500 Subject: [PATCH] ADD logging for device init --- lib/Xmobar/Plugins/Bluetooth.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Xmobar/Plugins/Bluetooth.hs b/lib/Xmobar/Plugins/Bluetooth.hs index c5eeb26..454401c 100644 --- a/lib/Xmobar/Plugins/Bluetooth.hs +++ b/lib/Xmobar/Plugins/Bluetooth.hs @@ -78,6 +78,7 @@ startAdapter is cs cb cl = do ot <- getBtObjectTree cl state <- newMVar emptyState let dpy = displayIcon cb (iconFormatter is cs) state + -- TODO if this fails it won't be logged forM_ (findAdapter ot) $ \adapter -> do -- set up adapter initAdapter state adapter cl @@ -227,9 +228,12 @@ initAdapter -> m () initAdapter state adapter client = do reply <- callGetPowered adapter client + logInfo $ "initializing adapter at path " <> adapter_ -- TODO this could fail if the variant is something weird; the only -- indication I will get is "NA" putPowered state $ fromSingletonVariant reply + where + adapter_ = displayWrapQuote $ displayObjectPath adapter matchBTProperty :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m) @@ -310,7 +314,9 @@ addAndInitDevice addAndInitDevice state dpy device client = do res <- addDeviceListener state dpy device client case res of - Just handler -> initDevice state handler device client + Just handler -> do + logInfo $ "initializing device at path " <> device_ + initDevice state handler device client Nothing -> logError $ "could not initialize device at path " <> device_ where device_ = displayWrapQuote $ displayObjectPath device