simple-log 0.8.4 → 0.8.5
raw patch · 3 files changed
+11/−12 lines, 3 files
Files
- simple-log.cabal +1/−1
- src/System/Log/Simple.hs +10/−9
- src/System/Log/Simple/Base.hs +0/−2
simple-log.cabal view
@@ -1,5 +1,5 @@ Name: simple-log -Version: 0.8.4 +Version: 0.8.5 Synopsis: Simple log for Haskell Description: Log library for Haskell License: BSD3
src/System/Log/Simple.hs view
@@ -21,9 +21,9 @@ -- sendLog Trace \"Hello from your function\" -- @ -- --- Each component can have different level in config, subcomponents are specified with '.' +-- Each component can have different level in config, subcomponents are specified with \'.\' -- Components have independent scopes --- Scopes can be nested and separated with '/': +-- Scopes can be nested and separated with \'/\': -- -- @ --function2 ∷ MonadLog m ⇒ m () @@ -35,8 +35,8 @@ -- component \"module\" $ sendLog Info \"Component module and root scope\" -- @ -- --- You can update config with @updateLogConfig@ function --- And change handlers with @updateLogHandlers@ +-- You can update config with @updateLogConfig@ (or @modifyLogConfig@ within log monad) function +-- And change handlers with @updateLogHandlers@ (@modifyLogHandlers@) -- -- There're also global logger @globalLog@, that can be used with @runGlobalLog@ -- @@ -44,9 +44,10 @@ --test ∷ IO () --test = do -- updateLogHandlers globalLog ([handler text (file \"test.log\")]:) --- runGlobalLog $ sendLog Info \"This will go to test.log too\" --- updateLogConfig globalLog (set (ix \"\") Debug) --- runGlobalLog $ sendLog Debug \"Now debug logs too\" +-- runGlobalLog $ do +-- sendLog Info \"This will go to test.log too\" +-- modifyLogConfig (set (ix \"\") Debug) +-- sendLog Debug \"Now debug is logged too\" -- @ -- module System.Log.Simple ( @@ -86,10 +87,10 @@ globalLog ∷ Log globalLog = unsafePerformIO $ newLog defCfg [handler text console] -runGlobalLog ∷ LogT IO a → IO a +runGlobalLog ∷ (MonadIO m, MonadMask m) ⇒ LogT m a → m a runGlobalLog = withLog globalLog -runConsoleLog ∷ LogConfig → LogT IO a → IO a +runConsoleLog ∷ (MonadIO m, MonadMask m) ⇒ LogConfig → LogT m a → m a runConsoleLog cfg = runLog cfg [handler text console] runLogChan ∷ (MonadIO m, MonadMask m) ⇒ (Chan w → LogHandler) → LogConfig → LogT m a → m (a, [w])
src/System/Log/Simple/Base.hs view
@@ -126,7 +126,6 @@ instance NFData Message where rnf (Message t l c s m) = t `seq` l `seq` rnf c `seq` rnf s `seq` rnf m --- | Converts message some representation type Converter a = Message → a -- | Returns function which accepts consumed value @@ -139,7 +138,6 @@ -- | Message handler type LogHandler = Consumer Message --- | Convert consumer creater to logger creater handler ∷ Converter a → Consumer a → Consumer Message handler conv = fmap (∘ conv)