Copyright | (c) Joseph Canero 2017 |
---|---|
License | MIT |
Maintainer | [email protected] |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Network.Wai.Middleware.FilterLogger
Description
Synopsis
- data FilterOptions = FilterOptions {
- detailed :: Bool
- logOnEmptyBody :: Bool
- type LogFilter a = a -> Maybe a
- class LogFilterable a where
- prep :: ByteString -> Maybe a
- class LogShowable a where
- logShow :: a -> ByteString
- class (LogFilterable a, LogShowable a) => Loggable a
- logFilterJSON :: FromJSON a => ByteString -> Maybe a
- logShowJSON :: ToJSON a => a -> ByteString
- 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
Default FilterOptions Source # | |
Defined in Network.Wai.Middleware.FilterLogger.Internal Methods def :: FilterOptions # |
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.
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
Instances
LogFilterable ByteString Source # | |
Defined in Network.Wai.Middleware.FilterLogger.Internal Methods prep :: ByteString -> Maybe ByteString Source # | |
LogFilterable ByteString Source # | |
Defined in Network.Wai.Middleware.FilterLogger.Internal Methods prep :: ByteString -> Maybe ByteString Source # |
class LogShowable a where Source #
Typeclass for types that can be converted into a strict ByteString
and be shown in a log.
Methods
logShow :: a -> ByteString Source #
Convert the type into a strict ByteString
to be displayed in the logs.
Instances
LogShowable ByteString Source # | |
Defined in Network.Wai.Middleware.FilterLogger.Internal Methods logShow :: ByteString -> ByteString Source # | |
LogShowable ByteString Source # | |
Defined in Network.Wai.Middleware.FilterLogger.Internal Methods logShow :: ByteString -> ByteString Source # |
class (LogFilterable a, LogShowable a) => Loggable a Source #
Helper Typeclass for types that implement both LogFilterable
and LogShowable
Instances
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.
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.
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.