Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Filterable a where
- data SomeHandler where
- SomeHandler :: Handler h => h -> SomeHandler
- class (HasType Level a, HasType Filterer a, HasType Format1 a, Typeable a, Eq a) => Handler a where
Documentation
class Filterable a where Source #
A class represents a common trait of filtering LogRecord
s
Instances
Filterable Filter Source # | |
Filterable Sink Source # | |
Filterable a => Filterable [a] Source # | |
data SomeHandler where Source #
Generalised Handler
instance, it wraps all other Handler
instances
into one type.
The SomeHandler
type is the root of the handler type hierarchy.
SomeHandler :: Handler h => h -> SomeHandler |
Instances
class (HasType Level a, HasType Filterer a, HasType Format1 a, Typeable a, Eq a) => Handler a where Source #
A type class that abstracts the characteristics of a Handler
Initialize the Handler
instance
emit :: a -> LogRecord -> IO () Source #
Emit log event, prepare log data, and send to bancked.
e.g. 1) Format LogRecord
into data in specific format (json, html, etc.),
2) write the data to a file or send the data to a server.
Terminate the Handler
instance
handle :: a -> LogRecord -> IO Bool Source #
Handle LogRecord
and decide whether to call emit
.
The default implementation is to filter LogRecord
by level and
Handler's filterer, if rejected, do nothing and return False,
otherwise call emit and return True.
Note: You can override the default implementation.
fromHandler :: SomeHandler -> Maybe a Source #
toHandler :: a -> SomeHandler Source #