| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Katip.Wai.Middleware
Synopsis
- type ApplicationT (m :: Type -> Type) = Request -> (Response -> m ResponseReceived) -> m ResponseReceived
- type MiddlewareT (m :: Type -> Type) = ApplicationT m -> ApplicationT m
- runApplication :: MonadIO m => (forall a. m a -> IO a) -> ApplicationT m -> Application
- middlewareCustom :: MonadIO m => Options m -> MiddlewareT m
- middleware :: KatipContext m => Severity -> MiddlewareT m
Documentation
type ApplicationT (m :: Type -> Type) = Request -> (Response -> m ResponseReceived) -> m ResponseReceived Source #
Just like Application except it runs in m instead of IO
type MiddlewareT (m :: Type -> Type) = ApplicationT m -> ApplicationT m Source #
Just like Middleware except it runs in m instead of IO
runApplication :: MonadIO m => (forall a. m a -> IO a) -> ApplicationT m -> Application Source #
Converts an ApplicationT to a normal Application
middlewareCustom :: MonadIO m => Options m -> MiddlewareT m Source #
Same as middleware, but allows you to customize how the Request
and Response are handled.
middleware :: KatipContext m => Severity -> MiddlewareT m Source #
Add the request and response to the LogContexts, and log a message
when a request is received and when a response is sent.
This uses the default format: defaultRequestFormat and defaultResponseFormat with milliseconds for the response time.
If you want more customization see middlewareCustom.