From 691e08015abb10b059477ba4c35f254e7a1f59be Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Fri, 22 Apr 2022 00:27:36 -0600 Subject: Infrastructure for better logging, finally! Right now all existing logs are logged at Info, but this will change. This should make it significantly easier to debug things wit log levels like Trace. I may at some point define more log level endpoints or come up with a more expressive logging system, but this is a good start. --- src/Rahm/Desktop/Keys/Wml.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Rahm/Desktop/Keys') diff --git a/src/Rahm/Desktop/Keys/Wml.hs b/src/Rahm/Desktop/Keys/Wml.hs index 7659a7d..dd82922 100644 --- a/src/Rahm/Desktop/Keys/Wml.hs +++ b/src/Rahm/Desktop/Keys/Wml.hs @@ -107,12 +107,12 @@ alternateWorkspace :: Workspace alternateWorkspace = Workspace { moveLocationToWorkspaceFn = \l@(Location _ maybeWin) -> do - logs $ "Moving Location: " ++ show l + logs Info "Moving Location: %s" (show l) case maybeWin of Nothing -> return () Just win -> do alter <- getAlternateWorkspace win - logs $ printf "Moving %s to %s" (show win) (show alter) + logs Info "Moving %s to %s" (show win) (show alter) mapM_ (moveLocationToWorkspace l) alter , gotoWorkspaceFn = do @@ -297,7 +297,7 @@ readNextLocationSet = mapM windowLocation =<< MaybeT askWindowId (_, _, "%") -> fromMaybeTX $ do ret <- mapM windowLocation =<< lift (withWindowSet (return . sortOn Down . W.allWindows)) - lift $ logs $ "allWindows " ++ intercalate "\n" (map show ret) + lift $ logs Info "allWindows %s" (intercalate "\n" (map show ret)) return ret (_, _, s) | s == "\t" || s == "@" || s == "\n" -> (mt . windowsInWorkspace . workspaceName) =<< readNextWorkspace @@ -329,7 +329,7 @@ readNextLocationSet = return $ filter (`elem` l2) l1 (mask, keysym, _) -> do macro <- (MaybeT . fromX) (Map.lookup (mask, keysym) . windowsetMacros <$> XS.get) - lift $ fromX $ logs $ "Executing Macro: " ++ show macro + lift $ fromX $ logs Info "Executing Macro: %s" (show macro) fromMaybeTX $ locationSetForKeysT macro where mt :: (KeyFeeder m) => X a -> MaybeT m a -- cgit