HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulewai-log-0.4.0.1Haskell2010

Network.Wai.Log

A simple logging middleware for WAI applications that supports the 'log-*' family of packages: https://hackage.haskell.org/package/log-base

When logging to stdout using defaultOptions, the output looks like this:

2020-10-27 12:30:23 INFO eid-server: Request received {
  "url": "/api/v1/transaction/new",
  "body_length": "KnownLength 136",
  "method": "POST",
  "user_agent": "curl/7.68.0",
  "request_id": "f2c89425-9ec4-4cd2-ae56-4bab23681fce",
  "remote_host": "127.0.0.1:34694"
}
2020-10-27 12:30:23 INFO eid-server: Sending response {
  "request_id": "f2c89425-9ec4-4cd2-ae56-4bab23681fce"
}
2020-10-27 12:30:23 INFO eid-server: Request complete {
  "response_body": null,
  "url": "/api/v1/transaction/new",
  "method": "POST",
  "status": {
    "code": 400,
    "message": "Bad Request"
  },
  "time": {
    "process": 2.97493e-3,
    "full": 3.159565e-3
  },
  "request_id": "f2c89425-9ec4-4cd2-ae56-4bab23681fce"
}
  • 3 types
  • 7 values
  • Packagewai-log-0.4.0.1
  • Exports10
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceLog.hs

Create a Middleware

2 declarations

Type

Options

datadata Options id
#

Logging options

Logging response body involves extracting it from Response via IO operations, therefore the logBody option takes Request, Status and ResponseHeaders as arguments to decide whether the IO operations of body extraction have to be performed. The resulting Maybe function is the constructor of a loggable Value from the body bytestring builder.

Constructors

Helpers