accesslog

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 3 Imported by: 0

README

Access Log

This package provides HTTP access logging for web applications.

Usage

Initialize the logger in main and use in HTTP handlers:

import "github.com/mariusfa/golf/logging/accesslog"

// In main function
appName := "todo"
accesslog.SetAppName(appName)

// Used in HTTP middleware or handlers
duration := 150 // milliseconds
status := 200
path := "/api/users"
method := "GET"

accesslog.Info(duration, status, path, method)

Purpose

Specifically designed for:

  • HTTP request/response logging
  • Performance monitoring (request duration)
  • Access pattern analysis
  • API usage tracking

Integration

This package is automatically used by the middleware package for request logging.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Info

func Info(
	ctx context.Context,
	durationMs int,
	status int,
	requestPath string,
	requestMethod string,
)

func NewAccessLogger

func NewAccessLogger(appName string) *slog.Logger

func SetAppName

func SetAppName(appName string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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