| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Logging.Class
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
- class IsMessage a where
- toMessage :: a -> String
- toMessageList :: [a] -> String
Documentation
class Filterable a where Source #
A class represents a common trait of filtering LogRecords
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.
Constructors
| 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
Minimal complete definition
Methods
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 #
Instances
class IsMessage a where Source #
A class for datatypes that can be converted to log message.
Since: 0.8.0
Minimal complete definition
Instances
| IsMessage Char Source # | |
| IsMessage ByteString Source # | |
Defined in Logging.Class.Message | |
| IsMessage ByteString Source # | |
Defined in Logging.Class.Message | |
| IsMessage Text Source # | |
| IsMessage Value Source # | |
| IsMessage Text Source # | |
| IsMessage SomeException Source # | |
Defined in Logging.Class.Message Methods toMessage :: SomeException -> String Source # toMessageList :: [SomeException] -> String Source # | |
| IsMessage a => IsMessage [a] Source # | |
Defined in Logging.Class.Message | |