accesslog

package
v0.7.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 10 Imported by: 0

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:

  1. Records the start time of the request
  2. Wraps the response writer to capture the status code
  3. Invokes the next handler
  4. 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

func WithLevel(level slog.Level) Option

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 WithSkip

func WithSkip(skip func(route string) bool) Option

WithSkip sets the function to determine if logging should be skipped for a given route Parameters:

  • skip: Function to determine if logging should be skipped for a given route

Returns:

  • Option: Function to set the skip function option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL