filter-logger-0.3.0.0: Filterable request logging wai middleware. Change how data is logged and when.

Copyright(c) Joseph Canero 2017
LicenseMIT
Maintainerjmc41493@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Network.Wai.Middleware.FilterLogger.Internal

Description

 

Synopsis

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

logShow

Methods

logShow :: a -> ByteString Source #

Convert the type into a strict ByteString to be displayed in the logs.

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

prep

Methods

prep :: ByteString -> Maybe a Source #

Try to convert the type from a strict ByteString.

class (LogFilterable a, LogShowable a) => Loggable a Source #

Helper Typeclass for types that implement both LogFilterable and LogShowable

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.