httpslog

package module
v0.0.0-...-2453341 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 12 Imported by: 0

README

chi-httpslog

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	LogLevel:        "info",
	LevelFieldName:  "level",
	Concise:         false,
	Tags:            nil,
	SkipHeaders:     nil,
	TimeFieldFormat: time.RFC3339Nano,
	TimeFieldName:   "timestamp",
}

Functions

func Configure

func Configure(opts Options)

func Handler

func Handler(logger *slog.Logger, optSkipPaths ...[]string) func(next http.Handler) http.Handler

func LogEntry

func LogEntry(ctx context.Context) *slog.Logger

func LogEntrySetField

func LogEntrySetField(ctx context.Context, key, value string)

func LogEntrySetFields

func LogEntrySetFields(ctx context.Context, fields map[string]interface{})

func NewLogger

func NewLogger(serviceName string, opts ...Options) *slog.Logger

func RequestLogger

func RequestLogger(logger *slog.Logger, skipPaths ...[]string) func(next http.Handler) http.Handler

Types

type Options

type Options struct {
	LogLevel        string
	LevelFieldName  string
	Concise         bool
	Tags            map[string]string
	SkipHeaders     []string
	TimeFieldFormat string
	TimeFieldName   string
}

type RequestLoggerEntry

type RequestLoggerEntry struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func (*RequestLoggerEntry) Panic

func (l *RequestLoggerEntry) Panic(v interface{}, stack []byte)

func (*RequestLoggerEntry) Write

func (l *RequestLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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