requestlog

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package requestlog logs every request a Tern app serves, with slog:

ternApp(kit.WithPlugins(requestlog.New()))

Each line has the method, path, status, duration and response size. 5xx responses log at error level and 4xx at warn; everything else at info.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Plugin)

Option configures the plugin.

func Logger

func Logger(l *slog.Logger) Option

Logger sets the logger. The default is the app's logger.

func SkipAssets

func SkipAssets() Option

SkipAssets leaves out requests for /_app/ assets and other files with an extension, which are usually noise.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin logs requests. Create it with New.

func New

func New(opts ...Option) *Plugin

New returns the request logging plugin.

func (*Plugin) Name

func (*Plugin) Name() string

Name implements kit.Plugin.

func (*Plugin) Setup

func (p *Plugin) Setup(s *kit.Setup) error

Setup implements kit.Plugin.

Jump to

Keyboard shortcuts

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