logging

package
v0.0.0-...-8f2bebf Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logging provides slog wrappers for jarl logging

Index

Constants

View Source
const (
	KeyError    = "error"             // KeyError represents the error attribute in structured logs
	KeyMethod   = "http.method"       // KeyMethod is the logging key for the http method
	KeyPath     = "http.path"         // KeyPath is the logging key for the inbound request path
	KeyHeaders  = "http.headers"      // KeyHeaders is the logging key for http headers
	KeyHost     = "http.host"         // KeyHost is the logging key for the inbound request host
	KeyContext  = "request.context"   // KeyContext is the request attributes
	KeyAllow    = "request.allow"     // KeyAllow is the logging key for the request outcome
	KeyClientID = "request.client.id" // KeyClientID is the logging key for the header identifier value
	KeyProtocol = "request.protocol"  // KeyProtocol is the logging key for the GRPC protocol version
	KeyReason   = "reason"            // KeyReason is the logging key for the deny reason
)

Variables

This section is empty.

Functions

func LogRequest

func LogRequest(allow bool, reason string, context *Context)

LogRequest logs an inbout request details

func Setup

func Setup()

Setup configures the logging environment

Types

type Context

type Context struct {
	Protocol       string
	Host           string
	Path           string
	Method         string
	ClientID       string
	Headers        map[string]string
	RequestContext interface{}
}

Context holds the request context for unified logging purposes

func AuthV2LoggingContext

func AuthV2LoggingContext(request *authv2.CheckRequest) *Context

AuthV2LoggingContext creates a logging context from an AuthV2 CheckRequest

func AuthV3LoggingContext

func AuthV3LoggingContext(request *authv3.CheckRequest) *Context

AuthV3LoggingContext creates a logging context from an AuthV3 CheckRequest

Jump to

Keyboard shortcuts

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