| Copyright | (c) Joseph Canero 2017 |
|---|---|
| License | MIT |
| Maintainer | jmc41493@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Wai.Middleware.FilterLogger.Internal
Description
- class LogShowable a where
- logShowJSON :: ToJSON a => a -> ByteString
- logFilterJSON :: FromJSON a => ByteString -> Maybe a
- class LogFilterable a where
- class (LogFilterable a, LogShowable a) => Loggable a
- type LogFilter a = a -> Maybe a
- mkFilterLogger :: Loggable a => Bool -> LogFilter a -> Middleware
Documentation
class LogShowable a where Source #
Typeclass for types that can be converted into a strict ByteString
and be shown in a log.
Minimal complete definition
Methods
logShow :: a -> ByteString Source #
Convert the type into a strict ByteString to be displayed in the logs.
Instances
logShowJSON :: ToJSON a => a -> ByteString Source #
Helper function that can be used when you want to make an instance of ToJSON an instance of
LogShowable. This helps avoid having to use UndecidableInstances.
logFilterJSON :: FromJSON a => ByteString -> Maybe a Source #
Helper function that can be used when you want to make an instance of FromJSON an instance of
LogFilterable. This helps avoid having to use UndecidableInstances.
class LogFilterable a where Source #
Typeclass for types that can be converted into from a strict ByteString and will be used as
arguments to LogFilter
Minimal complete definition
Instances
class (LogFilterable a, LogShowable a) => Loggable a Source #
Helper Typeclass for types that implement both LogFilterable and LogShowable
Instances
type LogFilter a = a -> Maybe a Source #
Type that represents a log filtering function. If the return type is Nothing, then no log message will be created. Otherwise, a log message will be created using the (potentially different) returned value.
mkFilterLogger :: Loggable a => Bool -> LogFilter a -> Middleware Source #
Given a valid LogFilter, construct a Middleware value that
will log messages where the request body of the incoming request passes
the filter. Accepts an optional Bool parameter for detailed logging or not.