Safe Haskell | None |
---|

- data Log a v = Log a v
- type Logger m l = forall v. Log l v -> m ()
- logE :: (Typeable l, Member (Log l) r) => l -> Eff r ()
- filterLog :: (Typeable l, Member (Log l) r) => (l -> Bool) -> Eff r a -> Eff r a
- filterLog' :: (Typeable l, Member (Log l) r) => (l -> Bool) -> proxy l -> Eff r a -> Eff r a
- runLogPure :: Typeable l => Eff (Log l :> r) a -> Eff r (a, [l])
- runLogStdout :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => proxy l -> Eff (Log l :> r) a -> Eff r a
- runLogStderr :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => proxy l -> Eff (Log l :> r) a -> Eff r a
- runLogFile :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => FilePath -> proxy l -> Eff (Log l :> r) a -> Eff r a
- runLogWithLoggerSet :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => LoggerSet -> proxy l -> Eff (Log l :> r) a -> Eff r a
- runLog :: (Typeable l, Typeable1 m, SetMember Lift (Lift m) r) => Logger m l -> Eff (Log l :> r) a -> Eff r a

# Documentation

filterLog :: (Typeable l, Member (Log l) r) => (l -> Bool) -> Eff r a -> Eff r aSource

Filter Log entries with a predicate.

Note that, most of the time an explicit type signature for the predicate will be required.

filterLog' :: (Typeable l, Member (Log l) r) => (l -> Bool) -> proxy l -> Eff r a -> Eff r aSource

Filter Log entries with a predicate and a proxy.

This is the same as `filterLog`

but with a proxy l for type inference.

runLogPure :: Typeable l => Eff (Log l :> r) a -> Eff r (a, [l])Source

Collect log messages in a list.

runLogStdout :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => proxy l -> Eff (Log l :> r) a -> Eff r aSource

Log to stdout.

runLogStderr :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => proxy l -> Eff (Log l :> r) a -> Eff r aSource

Log to stderr.

runLogFile :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => FilePath -> proxy l -> Eff (Log l :> r) a -> Eff r aSource

Log to file.

runLogWithLoggerSet :: (Typeable l, ToLogStr l, SetMember Lift (Lift IO) r) => LoggerSet -> proxy l -> Eff (Log l :> r) a -> Eff r aSource

Log to a file using a `LoggerSet`

.

Note, that you will still have to call `flushLogStr`

on the `LoggerSet`

at one point.

With that function you can combine a logger in a surrounding IO action
with a logger in the `Eff`

effect.

data Proxy a = Proxy main :: IO () main = do loggerSet <- newStderrLoggerSet defaultBufSize pushLogStr loggerSet "logging from outer space^WIO\n" runLift $ runLogWithLoggerSet loggerSet (Proxy :: Proxy String) $ logE ("logging from within Eff" :: String) flushLogStr loggerSet