packages feed

log-effect 1.0.0 → 1.0.1

raw patch · 2 files changed

+54/−3 lines, 2 filesdep ~extensible-effectsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: extensible-effects

API changes (from Hackage documentation)

Files

+ README.md view
@@ -0,0 +1,51 @@+# Log effect++[![Build Status](https://secure.travis-ci.org/greydot/log-effect.png)](http://travis-ci.org/greydot/log-effect)++An extensible log effect using extensible-effects. This library introduces two+new effects to your extensible effects arsenal, `Log` and `LogM`. In short, if+you'd like to add logging to pure code (that is, without Lift effect), `Log` is+your best choice, otherwise go for `LogM`.++## Log++This is the simpler of the two. `Log` allows for logging in pure code, as well+as filtering using `filterLog`. The downside of this effect is that when your+code launches multiple threads using `async` or `forkIO`, messages from every+thread other than the thread where the handler is run will be lost.++## LogM++`LogM` loses the ability to provide logging in pure code, but at the same time+allows to log messages from multiple threads.++## Example++```haskell+import Control.Concurrent.Lifted+import Control.Eff+import Control.Eff.Lift+import Control.Eff.Log++someComp :: ( [ Log String, LogM IO String ] <:: r+            , LiftedBase IO r+            ) => Eff r ()+someComp = do logE "Hello!"+              logM "Greetings from the main thread!"+              +              _ <- fork $ do logM "This is a new thread, and this message is still visible."+                             logE "Unfortunately, this one is not."+              return ()++main :: IO ()+main = runLift $ runLog logger $ runLogM logger $ someComp+  where+    -- Here we have to provide an explicit signature for our logger,+    -- because the compiler is unable to figure it out due to ambiguity.+    logger = stdoutLogger :: Logger IO String+```++## See also++[log-effect-syslog](http://hackage.haskell.org/package/log-effect-syslog)+provides necessary types and functions to work with syslog.
log-effect.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                log-effect-version:             1.0.0+version:             1.0.1 synopsis:            An extensible log effect using extensible-effects description:         Introduce two logging effects to your extensible effects arsenal homepage:            https://github.com/greydot/log-effect@@ -13,7 +13,7 @@ -- copyright:            category:            Control, Effect, Logging build-type:          Simple-extra-source-files:    Changelog.md+extra-source-files:  Changelog.md, README.md cabal-version:       >=1.10 Tested-With:         GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1 @@ -23,7 +23,7 @@   -- other-extensions:       build-depends:       base >=4.6 && <5.0                      , bytestring >= 0.10-                     , extensible-effects >= 2.5.1.0+                     , extensible-effects >= 2.6.0.0                      , monad-control >= 1.0                      , text >= 1.2                      , transformers-base >= 0.4