Documentation
¶
Overview ¶
Package accesslog provides HTTP access logging middleware for server requests
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Client ¶
func Client(opts ...Option) client.Middleware
func Server ¶
func Server(opts ...Option) server.Middleware
Server creates a server-side access logging middleware Parameters:
- opts: Variable number of Option functions for configuration
Returns:
- server.Middleware: Server middleware function
Behavior:
- Records the start time of the request
- Wraps the response writer to capture the status code
- Invokes the next handler
- Logs request details including latency and response status
Types ¶
type Option ¶
type Option func(o *options)
Option is a function type for configuring access log middleware options
func WithLevel ¶
WithLevel sets the log level for access log entries Parameters:
- level: Log level for access logs
Returns:
- Option: Function to set the log level option
func WithPrintRequest ¶ added in v1.7.18
WithPrintRequest enables or disables printing request body in access logs Parameters:
- print: Whether to print request body
Returns:
- Option: Function to set the print request option
func WithPrintResponse ¶ added in v1.7.18
WithPrintResponse enables or disables printing response body in access logs Parameters:
- print: Whether to print response body
Returns:
- Option: Function to set the print response option
Click to show internal directories.
Click to hide internal directories.