slog

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerWithRequest

func LoggerWithRequest(req *http.Request, logger *slog.Logger) *slog.Logger

LoggerWithRequest returns a `slog.Logger` instance with the following keys set: (HTTP) method, user agent, path, remote addr and user ip.

func ReadUserIP

func ReadUserIP(req *http.Request) string

ReadUserIP returns the value of the `X-Real-Ip` or `X-Forwarded-For` headers (in that order) or the default remote address reported by 'req'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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