diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-09-03 21:14:13 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-09-05 00:32:06 +0000 |
commit | cd217ecf5bc7a04c9d594876f753916a098bf3b7 (patch) | |
tree | 94879e49053523031f5d3519bad54f12282719c5 /hsm-web/Main.hs | |
parent | 9a25a505a77a56e9dfa277618d01d33deb19a2e1 (diff) |
Adds CLI parser generator for multiple logger severity settings
Diffstat (limited to 'hsm-web/Main.hs')
-rw-r--r-- | hsm-web/Main.hs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/hsm-web/Main.hs b/hsm-web/Main.hs index 9eef1e7..d1a9da3 100644 --- a/hsm-web/Main.hs +++ b/hsm-web/Main.hs @@ -1,7 +1,20 @@ +{-# LANGUAGE TemplateHaskell #-} + import Effectful (runEff) import Hsm.Cam (runCam) -import Hsm.Log (Severity(Info), runLogs) +import Hsm.Log (Severity(Info), runLogsOpt) +import Hsm.Log.Options (makeLoggerOptionParser) import Hsm.Web (runServer, runWeb) +-- Import full module for cleaner `-ddump-splices` output +-- Avoids package/module qualifiers in generated code +import Options.Applicative + +type Loggers = '[ "cam", "libcamera", "scotty", "web"] + +$(makeLoggerOptionParser @Loggers "Options" "parser" 'Info) + main :: IO () -main = runEff . runLogs @'[ "cam", "libcamera", "scotty", "web"] Info . runCam . runWeb $ runServer +main = do + opt <- execParser . info (parser <**> helper) $ fullDesc <> progDesc "Launch HsMouse Web Server" + runEff . runLogsOpt @Options @Loggers opt . runCam . runWeb $ runServer |