| 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
- data FilterOptions = FilterOptions {
- detailed :: Bool
- logOnEmptyBody :: Bool
- 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
- mkDefaultFilterLogger :: Loggable a => LogFilter a -> Middleware
- mkFilterLogger :: Loggable a => FilterOptions -> LogFilter a -> Middleware
Documentation
data FilterOptions Source #
Options for controlling log filtering.
Constructors
| FilterOptions | |
Fields
| |
Instances
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.
mkDefaultFilterLogger :: Loggable a => LogFilter a -> Middleware Source #
Make a filtering request logger with the default FilterOptions.
mkFilterLogger :: Loggable a => FilterOptions -> LogFilter a -> Middleware Source #
Given a valid LogFilter and custom FilterOptions, construct a filtering request logger.