aboutsummaryrefslogtreecommitdiff
path: root/hsm-log
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-08-25 03:05:35 +0000
committerPaul Oliver <contact@pauloliver.dev>2025-08-27 04:17:11 +0000
commit3806bd1f5ce56afdbb4cc0c1ed54d53e25603be2 (patch)
treee8eb9efb2b6c1abfaa0569b7c60b2f371fb215ef /hsm-log
parentc6bd9536038af5949924d1ad20a121bb10553300 (diff)
Improves `hsm-cam`
- Moves C++ constants to Haskell side - Uses better names for request callback related variables - Captures and redirects libcamera's internal logging
Diffstat (limited to 'hsm-log')
-rw-r--r--hsm-log/Hsm/Log.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/hsm-log/Hsm/Log.hs b/hsm-log/Hsm/Log.hs
index d8dbab0..570b19a 100644
--- a/hsm-log/Hsm/Log.hs
+++ b/hsm-log/Hsm/Log.hs
@@ -5,6 +5,7 @@
module Hsm.Log
( Severity(Attention, Info, Trace)
, Log
+ , getLevel
, makeLoggerIO
, logMsg
, logBlock
@@ -37,10 +38,13 @@ type instance DispatchOf (Log d) = Static WithSideEffects
newtype instance StaticRep (Log d) =
Log Severity
+getLevel :: Log d :> es => Eff es Severity
+getLevel = getStaticRep >>= \(Log level) -> return level
+
makeLoggerIO ::
forall d es. (KnownSymbol d, Log d :> es)
=> Eff es (Severity -> String -> IO ())
-makeLoggerIO = getStaticRep >>= \(Log level) -> return $ loggerIO level
+makeLoggerIO = loggerIO <$> getLevel
where
loggerIO level severity message =
when (severity <= level) $ do