Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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
- logReq :: MonadIO m => Verbosity -> Plugin m
- logResp :: MonadIO m => Verbosity -> Plugin m
- logReqBy :: MonadIO m => (Value -> m ()) -> Verbosity -> Plugin m
- logRespBy :: forall m. MonadIO m => (Value -> m ()) -> Verbosity -> Plugin m
- logHttp :: MonadIO m => Verbosity -> Plugin m
- logHttpBy :: MonadIO m => (Value -> m ()) -> Verbosity -> Plugin m
- ppReq :: Verbosity -> Maybe UTCTime -> Either Text ByteString -> Request -> Value
- data Verbosity
- withLogs :: MonadIO m => Server m -> Server m
- withLogsBy :: MonadIO m => (Value -> m ()) -> Server m -> Server m
Documentation
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
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