packages feed

di 1.2.2 → 1.3

raw patch · 3 files changed

+29/−16 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Di: alert' :: MonadDi Level path Message m => Message -> m ()
- Di: critical' :: MonadDi Level path Message m => Message -> m ()
- Di: debug' :: MonadDi Level path Message m => Message -> m ()
- Di: emergency' :: MonadDi Level path Message m => Message -> m ()
- Di: error' :: MonadDi Level path Message m => Message -> m ()
- Di: info' :: MonadDi Level path Message m => Message -> m ()
- Di: notice' :: MonadDi Level path Message m => Message -> m ()
- Di: warning' :: MonadDi Level path Message m => Message -> m ()
+ Di: alert_ :: MonadDi Level path Message m => Message -> m ()
+ Di: attr_ :: MonadDi level Path msg m => Key -> Value -> m a -> m a
+ Di: class Monad m => MonadDi level path msg (m :: Type -> Type) | m -> level path msg
+ Di: critical_ :: MonadDi Level path Message m => Message -> m ()
+ Di: debug_ :: MonadDi Level path Message m => Message -> m ()
+ Di: emergency_ :: MonadDi Level path Message m => Message -> m ()
+ Di: error_ :: MonadDi Level path Message m => Message -> m ()
+ Di: info_ :: MonadDi Level path Message m => Message -> m ()
+ Di: local :: MonadDi level path msg m => (Di level path msg -> Di level path msg) -> m a -> m a
+ Di: natSTM :: MonadDi level path msg m => STM a -> m a
+ Di: notice_ :: MonadDi Level path Message m => Message -> m ()
+ Di: warning_ :: MonadDi Level path Message m => Message -> m ()

Files

CHANGELOG.md view
@@ -1,3 +1,15 @@+# Version 1.3++* COMPILER ASSISTED BREAKING CHANGE: Renaming logging functions again.+  For example, `info` is the name we give to the `ToMessage`-polymorphic+  logging functions, `info_` to their `Message`-monomorphic version, and+  `info'` to the `STM` version. The previous `STM` suffix in `infoSTM`+  is gone, so as to mimick the naming conventions of `di-core`.++* Re-export `attr_` from `Di.Df1.Monad`.++* Re-export all of `MonadDi(..)` from `Di.Df1.Monad`.+ # Version 1.2.2  * Re-export `ask` from `Di.Df1.Monad`.
di.cabal view
@@ -1,5 +1,5 @@ name: di-version: 1.2.2+version: 1.3 author: Renzo Carbonara maintainer: renλren.zone copyright: Renzo Carbonara 2017
lib/Di.hs view
@@ -68,6 +68,7 @@  , Di.Df1.Monad.push    -- * Metadata  , Di.Df1.Monad.attr+ , Di.Df1.Monad.attr_    -- * Logging  , Di.Df1.Monad.debug  , Di.Df1.Monad.info@@ -78,14 +79,14 @@  , Di.Df1.Monad.critical  , Di.Df1.Monad.emergency    -- ** Better type-inference- , Di.Df1.Monad.debug'- , Di.Df1.Monad.info'- , Di.Df1.Monad.notice'- , Di.Df1.Monad.warning'- , Di.Df1.Monad.error'- , Di.Df1.Monad.alert'- , Di.Df1.Monad.critical'- , Di.Df1.Monad.emergency'+ , Di.Df1.Monad.debug_+ , Di.Df1.Monad.info_+ , Di.Df1.Monad.notice_+ , Di.Df1.Monad.warning_+ , Di.Df1.Monad.error_+ , Di.Df1.Monad.alert_+ , Di.Df1.Monad.critical_+ , Di.Df1.Monad.emergency_     -- * Exceptions  , Di.Monad.throw@@ -93,7 +94,7 @@    -- * Support for @MonadDi@ and @DiT@  , Di.Monad.runDiT  , Di.Monad.hoistDiT- , Di.Monad.ask+ , Di.Monad.MonadDi(..)     -- * Convenient type-synonyms  , Di.Df1.Df1@@ -144,24 +145,24 @@ --       -- all your logging from within a 'Di.Df1.Monad.MonadDf1'. --       'Di.Monad.runDiT' di $ do --           -- Our first log message!---           'Di.Df1.Monad.notice'' "Welcome to my program!"+--           'Di.Df1.Monad.notice_' "Welcome to my program!" --           -- You can use `push` to separate different --           -- logging scopes of your program: --           'Di.Df1.Monad.push' "initialization" $ do---               'Di.Df1.Monad.notice'' "Starting web server"---               'Di.Df1.Monad.alert'' "Disk is almost full"+--               'Di.Df1.Monad.notice_' "Starting web server"+--               'Di.Df1.Monad.alert_' "Disk is almost full!!!" --           -- Yet another scope. --           'Di.Df1.Monad.push' "server" $ do --               -- You can use 'Di.Df1.Monad.attr' to add metadata to --               -- messages logged within a particular scope. --               'Di.Df1.Monad.attr' "port" (80 :: Int) $ do---                    'Di.Df1.Monad.info'' "Listening for new clients"+--                    'Di.Df1.Monad.info_' "Listening for new clients" --                    clientAddress <- do --                       -- This is just an example. Whatever. --                       pure ("10.0.0.8" :: String) --                    'Di.Df1.Monad.push' "handler" $ do --                       'Di.Df1.Monad.attr' "client-address" clientAddress $ do---                          'Di.Df1.Monad.info'' "Connection established"+--                          'Di.Df1.Monad.info_' "Connection established" --                          -- If you throw an exception with throw, --                          -- it will be logged automatically together --                          -- with its current scope. Isn't that nice?@@ -179,7 +180,7 @@ -- @ -- 2019-11-15T18:05:54.949470902Z NOTICE Welcome to my program! -- 2019-11-15T18:05:54.949623731Z \/initialization NOTICE Starting web server--- 2019-11-15T18:05:54.949630205Z \/initialization ALERT Disk is almost full+-- 2019-11-15T18:05:54.949630205Z \/initialization ALERT Disk is almost full!!! -- 2019-11-15T18:05:54.949640299Z \/server port=80 INFO Listening for new clients -- 2019-11-15T18:05:54.949652133Z \/server port=80 \/handler client-address=10.0.0.8 INFO Connection established -- 2019-11-15T18:05:54.949664482Z \/server port=80 \/handler client-address=10.0.0.8 WARNING user error (Oops!)