File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,36 @@ A logger effect for the
44[ ` fused-effects ` ] ( https://github.com/fused-effects/fused-effects ) library, based
55on the [ ` monad-logger ` ] ( https://github.com/snoyberg/monad-logger ) API.
66
7+ # Usage
8+ In addition to ` fused-effects-logger ` , you most probably want to add
9+ ` monad-logger ` as well in order to use its logging functions.
10+
11+ Here is a simple example to start running a program that logs to ` stderr ` :
12+
13+ ``` haskell
14+ {-# LANGUAGE OverloadedStrings #-}
15+ {-# LANGUAGE TemplateHaskell #-}
16+
17+ module Main (main ) where
18+
19+ import Control.Carrier.Lift (runM )
20+ import Control.Carrier.Logger.IO (runStderrLoggerIO )
21+ import Control.Effect.Lift (sendM )
22+ import Control.Monad.Logger (logInfo )
23+
24+ main :: IO ()
25+ main = runM . runStderrLoggerIO $ do
26+ $ (logInfo) " hello from fused-effects-logger"
27+ sendM (print 42 )
28+ ```
29+
30+ It should produce the output:
31+
32+ ```
33+ [Info] hello from fused-effects-logger @(test-logger-0.1.0.0-KTuyx50rxPBAwC1EHp8UuV-test-logger-exe:Main app/Main.hs:13:4)
34+ 42
35+ ```
36+
737# Contributing
838
939Please follow the process describe in [ ` RELEASE.md ` ] ( ./RELEASE.md ) to release
You can’t perform that action at this time.
0 commit comments