@@ -65,6 +65,7 @@ module Colog.Json
65
65
import Colog.Core hiding (Severity )
66
66
import Colog.Json.Internal.Structured
67
67
import Control.Concurrent
68
+ import Control.Monad.IO.Class
68
69
import Data.Sequence qualified as Seq
69
70
import Data.Text qualified as T
70
71
@@ -170,7 +171,7 @@ addNamespace ns LoggerEnv{..} = LoggerEnv{context=context Seq.|> Segment ns, ..}
170
171
171
172
logDebug, logNotice, logInfo, logWarn,
172
173
logErr, logAlert, logCrit, logEmergency
173
- :: LoggerEnv -> LogStr -> IO ()
174
+ :: MonadIO m => LoggerEnv -> LogStr -> m ()
174
175
logDebug x = logSay x DebugS
175
176
logNotice x = logSay x InfoS
176
177
logInfo x = logSay x InfoS
@@ -181,10 +182,12 @@ logAlert x = logSay x AlertS
181
182
logEmergency x = logSay x EmergencyS
182
183
183
184
-- | Internal logger function.
184
- logSay :: LoggerEnv -- ^ Logger handle.
185
+ logSay :: MonadIO m
186
+ => LoggerEnv -- ^ Logger handle.
185
187
-> Severity -- ^ Message severity.
186
188
-> LogStr -- ^ Message itself.
187
- -> IO ()
188
- logSay (LoggerEnv action context) lvl msg = do
189
+ -> m ()
190
+ logSay (LoggerEnv action context) lvl msg = liftIO $ do
189
191
tid <- myThreadId
190
192
unLogAction action $ Message lvl (mkThreadId tid) context msg
193
+ {-# SPECIALIZE logSay :: LoggerEnv -> Severity -> LogStr -> IO () #-}
0 commit comments