katip 0.8.2.0 → 0.8.3.0
raw patch · 4 files changed
+30/−14 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Katip: logKatipItem :: (Applicative m, LogItem a, Katip m) => Item a -> m ()
+ Katip.Core: logKatipItem :: (Applicative m, LogItem a, Katip m) => Item a -> m ()
- Katip: itemApp :: forall a_aeHF. Lens' (Item a_aeHF) Namespace
+ Katip: itemApp :: forall a_aeRZ. Lens' (Item a_aeRZ) Namespace
- Katip: itemEnv :: forall a_aeHF. Lens' (Item a_aeHF) Environment
+ Katip: itemEnv :: forall a_aeRZ. Lens' (Item a_aeRZ) Environment
- Katip: itemHost :: forall a_aeHF. Lens' (Item a_aeHF) HostName
+ Katip: itemHost :: forall a_aeRZ. Lens' (Item a_aeRZ) HostName
- Katip: itemLoc :: forall a_aeHF. Lens' (Item a_aeHF) (Maybe Loc)
+ Katip: itemLoc :: forall a_aeRZ. Lens' (Item a_aeRZ) (Maybe Loc)
- Katip: itemMessage :: forall a_aeHF. Lens' (Item a_aeHF) LogStr
+ Katip: itemMessage :: forall a_aeRZ. Lens' (Item a_aeRZ) LogStr
- Katip: itemNamespace :: forall a_aeHF. Lens' (Item a_aeHF) Namespace
+ Katip: itemNamespace :: forall a_aeRZ. Lens' (Item a_aeRZ) Namespace
- Katip: itemPayload :: forall a_aeHF a_al3H. Lens (Item a_aeHF) (Item a_al3H) a_aeHF a_al3H
+ Katip: itemPayload :: forall a_aeRZ a_ale0. Lens (Item a_aeRZ) (Item a_ale0) a_aeRZ a_ale0
- Katip: itemProcess :: forall a_aeHF. Lens' (Item a_aeHF) ProcessID
+ Katip: itemProcess :: forall a_aeRZ. Lens' (Item a_aeRZ) ProcessID
- Katip: itemSeverity :: forall a_aeHF. Lens' (Item a_aeHF) Severity
+ Katip: itemSeverity :: forall a_aeRZ. Lens' (Item a_aeRZ) Severity
- Katip: itemThread :: forall a_aeHF. Lens' (Item a_aeHF) ThreadIdText
+ Katip: itemThread :: forall a_aeRZ. Lens' (Item a_aeRZ) ThreadIdText
- Katip: itemTime :: forall a_aeHF. Lens' (Item a_aeHF) UTCTime
+ Katip: itemTime :: forall a_aeRZ. Lens' (Item a_aeRZ) UTCTime
- Katip.Core: itemApp :: forall a_aeHF. Lens' (Item a_aeHF) Namespace
+ Katip.Core: itemApp :: forall a_aeRZ. Lens' (Item a_aeRZ) Namespace
- Katip.Core: itemEnv :: forall a_aeHF. Lens' (Item a_aeHF) Environment
+ Katip.Core: itemEnv :: forall a_aeRZ. Lens' (Item a_aeRZ) Environment
- Katip.Core: itemHost :: forall a_aeHF. Lens' (Item a_aeHF) HostName
+ Katip.Core: itemHost :: forall a_aeRZ. Lens' (Item a_aeRZ) HostName
- Katip.Core: itemLoc :: forall a_aeHF. Lens' (Item a_aeHF) (Maybe Loc)
+ Katip.Core: itemLoc :: forall a_aeRZ. Lens' (Item a_aeRZ) (Maybe Loc)
- Katip.Core: itemMessage :: forall a_aeHF. Lens' (Item a_aeHF) LogStr
+ Katip.Core: itemMessage :: forall a_aeRZ. Lens' (Item a_aeRZ) LogStr
- Katip.Core: itemNamespace :: forall a_aeHF. Lens' (Item a_aeHF) Namespace
+ Katip.Core: itemNamespace :: forall a_aeRZ. Lens' (Item a_aeRZ) Namespace
- Katip.Core: itemPayload :: forall a_aeHF a_al3H. Lens (Item a_aeHF) (Item a_al3H) a_aeHF a_al3H
+ Katip.Core: itemPayload :: forall a_aeRZ a_ale0. Lens (Item a_aeRZ) (Item a_ale0) a_aeRZ a_ale0
- Katip.Core: itemProcess :: forall a_aeHF. Lens' (Item a_aeHF) ProcessID
+ Katip.Core: itemProcess :: forall a_aeRZ. Lens' (Item a_aeRZ) ProcessID
- Katip.Core: itemSeverity :: forall a_aeHF. Lens' (Item a_aeHF) Severity
+ Katip.Core: itemSeverity :: forall a_aeRZ. Lens' (Item a_aeRZ) Severity
- Katip.Core: itemThread :: forall a_aeHF. Lens' (Item a_aeHF) ThreadIdText
+ Katip.Core: itemThread :: forall a_aeRZ. Lens' (Item a_aeRZ) ThreadIdText
- Katip.Core: itemTime :: forall a_aeHF. Lens' (Item a_aeHF) UTCTime
+ Katip.Core: itemTime :: forall a_aeRZ. Lens' (Item a_aeRZ) UTCTime
Files
- changelog.md +5/−0
- katip.cabal +1/−1
- src/Katip.hs +1/−0
- src/Katip/Core.hs +23/−13
changelog.md view
@@ -1,3 +1,8 @@+0.8.3.0+=======++* Add `logKatipItem` function and reimplement `logItem` to use it. [vlatkoB](https://github.com/vlatkoB)+ 0.8.2.0 ======= * Add `MonadFail` instances for `base` >= 4.9.0.0 [Koray Al](https://github.com/korayal)
katip.cabal view
@@ -1,5 +1,5 @@ name: katip-version: 0.8.2.0+version: 0.8.3.0 synopsis: A structured logging framework. description: Katip is a structured logging framework. See README.md for more details.
src/Katip.hs view
@@ -161,6 +161,7 @@ , logT , logLoc , logItem+ , logKatipItem , logException -- ** 'KatipContext': Logging With Context -- $katipcontextlogging
src/Katip/Core.hs view
@@ -941,19 +941,29 @@ -> m () logItem a ns loc sev msg = do LogEnv{..} <- getLogEnv- liftIO $ do- item <- Item- <$> pure _logEnvApp- <*> pure _logEnvEnv- <*> pure sev- <*> (mkThreadIdText <$> myThreadId)- <*> pure _logEnvHost- <*> pure _logEnvPid- <*> pure a- <*> pure msg- <*> _logEnvTimer- <*> pure (_logEnvApp <> ns)- <*> pure loc+ logKatipItem =<< liftIO+ (Item <$> pure _logEnvApp+ <*> pure _logEnvEnv+ <*> pure sev+ <*> (mkThreadIdText <$> myThreadId)+ <*> pure _logEnvHost+ <*> pure _logEnvPid+ <*> pure a+ <*> pure msg+ <*> _logEnvTimer+ <*> pure (_logEnvApp <> ns)+ <*> pure loc)++-- | Log already constructed 'Item'. This is the lowest level function that other log*+-- functions use.+-- It can be useful when implementing centralised logging services.+logKatipItem+ :: (A.Applicative m, LogItem a, Katip m)+ => Item a+ -> m ()+logKatipItem item = do+ LogEnv{..} <- getLogEnv+ liftIO $ FT.forM_ (M.elems _logEnvScribes) $ \ ScribeHandle {..} -> do whenM (scribePermitItem shScribe item) $ void $ atomically (tryWriteTBQueue shChan (NewItem item))