Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

## Synopsis

- data Log l v
- data LogM m l v
- type Logger m l = l -> m ()
- stdoutLogger :: (LogMessage l, MonadBase IO m) => Logger m l
- stderrLogger :: (LogMessage l, MonadBase IO m) => Logger m l
- class LogMessage l where
- logE :: Member (Log l) r => l -> Eff r ()
- logM :: (Member (LogM m l) r, Lifted m r) => l -> Eff r ()
- filterLog :: forall l r a. Member (Log l) r => (l -> Bool) -> Eff r a -> Eff r a
- filterLog' :: Member (Log l) r => (l -> Bool) -> proxy l -> Eff r a -> Eff r a
- runLogPure :: Eff (Log l ': r) a -> Eff r (a, [l])
- runLog :: Lifted m r => Logger m l -> Eff (Log l ': r) a -> Eff r a
- runLogM :: Lifted m r => Logger m l -> Eff (LogM m l ': r) a -> Eff r a

# Documentation

Simple log effect, useful in pure code

A more advanced version of `Log`

. Adds an ability to log from multiple threads.

stdoutLogger :: (LogMessage l, MonadBase IO m) => Logger m l Source #

Logger that outputs messages to stdout

stderrLogger :: (LogMessage l, MonadBase IO m) => Logger m l Source #

Logger that outputs messages to stderr

class LogMessage l where Source #

Handy typeclass to convert log messages for output

toMsg :: l -> ByteString Source #

## Instances

LogMessage ByteString Source # | |

Defined in Control.Eff.Log toMsg :: ByteString -> ByteString Source # | |

LogMessage Text Source # | |

Defined in Control.Eff.Log toMsg :: Text -> ByteString Source # | |

LogMessage [Char] Source # | |

Defined in Control.Eff.Log toMsg :: [Char] -> ByteString Source # |

filterLog :: forall l r a. Member (Log l) r => (l -> Bool) -> Eff r a -> Eff r a Source #

Filter Log entries with a predicate.

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

filterLog' :: Member (Log l) r => (l -> Bool) -> proxy l -> Eff r a -> Eff r a Source #

Filter Log entries with a predicate and a proxy.

This is the same as `filterLog`

but with a proxy l for type inference.