mig-extra-0.1.1.0: Extra utils for Mig core library
Safe HaskellSafe-Inferred
LanguageGHC2021

Mig.Extra.Plugin.Trace

Description

Debug utils for server. Simple logger for HTTP requests and responses Also we can use real logging functions with ***By versions of the logger functions. Simple variants are only for local testing. It prints to stdout with no ordering of the concurrent prints.

It can be useful for fast setup of debug for your application. Example of the usage:

applyPlugin (logHttp V2) server
Synopsis

Documentation

logReq :: MonadIO m => Verbosity -> Plugin m Source #

Logs requests

logResp :: MonadIO m => Verbosity -> Plugin m Source #

Logs response

logReqBy :: MonadIO m => (Value -> m ()) -> Verbosity -> Plugin m Source #

Logs requests with custom logger

logRespBy :: forall m. MonadIO m => (Value -> m ()) -> Verbosity -> Plugin m Source #

Logs response with custom logger

logHttp :: MonadIO m => Verbosity -> Plugin m Source #

Logging of requests and responses

logHttpBy :: MonadIO m => (Value -> m ()) -> Verbosity -> Plugin m Source #

Logging of requests and responses with custom logger

ppReq :: Verbosity -> Maybe UTCTime -> Either Text ByteString -> Request -> Value Source #

Pretty prints the request

data Verbosity Source #

Verbosity level of echo prints

Constructors

V0

prints nothing

V1

prints time, path query, essential headers

V2

prints V1 + body

V3

prints V2 + all headers

withLogsBy :: MonadIO m => (Value -> m ()) -> Server m -> Server m Source #