Releases: davenverse/http4s-log4cats-contextlog
Releases · davenverse/http4s-log4cats-contextlog
v0.0.1
Initial Release of ContextLogging Middlewares!
Try them out
import io.chrisdavenport.http4s.log4cats.contextlog.{ServerMiddleware, ClientMiddleware}
val loggedRoutes = ServerMiddleware.fromLogger(yourLogger).httpRoutes(yourRoutes)
val loggedApp = ServerMiddleware.fromLogger(yourLogger).httpRoutes(yourApp)
val loggedClient = ClientMiddleware.fromLogger(yourLogger).client(yourClient)
Interfaces were kept similar between client and server for easy reuse, even where some things had slight misalignment.
Some useful option that are available.
- You can enable/disable logging for any request.
withWillLog
- You can remove any keys from the context that would have been added with
withRemovedContextKeys
- You can classify your routes, giving nice clean separations with
withRouteClassfier
- You can remove the url, in case you have sensitive information in your urls
withIncludeUrl
- You can add any additional context you want to either requests or responses
withAdditionalRequestContext
andwithAdditionalResponseContext
- You can log the request and response bodies
withLogRequestBody
andwithLogResponseBody
- You can pick that maximum size that it will still try to log a body, so chunked and large requests will automatically not have their bodies logged
withRequestBodyMaxSize
andwithResponseBodyMaxSize
- You can customize the level and if to log with information from both the request and the response
withLogLevel
- You can customize the log written with both the request and response
withLogMessage
- You can customize the set of automatically allowed headers that will be added to the context.
withAllowedRequestHeaders
andwithAllowedResponseHeaders