Help us shape the future of Go! Take the 2026 Go Developer Survey

authlog

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "[auth-token]"

Variables

This section is empty.

Functions

func Endpoint

func Endpoint(raw string) (string, string)

Endpoint returns only the host and path of a URL. Userinfo, query, and fragments are deliberately discarded.

func Log

func Log(ctx context.Context, event Event)

Log writes an always-on token lifecycle event with safe structured fields.

func SafeUserID

func SafeUserID(value string) string

SafeUserID returns a sanitized canonical identifier and suppresses values that look like credential or configuration URLs.

func Sanitize

func Sanitize(value string) string

Sanitize redacts common credential representations and URL secrets before truncating to a bounded number of Unicode characters.

func Status

func Status(value string) int

Status is useful for logging a status when the caller only has a string.

func WithRefreshAttempt added in v0.1.57

func WithRefreshAttempt(ctx context.Context) context.Context

WithRefreshAttempt gives one refresh operation a log correlation ID.

Types

type Event

type Event struct {
	Op             string
	UserID         string
	Provider       string
	AttemptID      string
	Source         string
	Reason         string
	RefreshRotated string
	IDTokenSource  string
	Caller         string
	ScheduleID     string
	RunID          string
	Endpoint       string
	HTTPStatus     int
	OAuthErrorCode string
	Classification string
	Action         string
	Elapsed        time.Duration
	Recovered      bool
	Err            error
}

Event is a safe, stable token-lifecycle log record. Empty fields remain present in the log so automated searches can rely on a consistent shape.

Jump to

Keyboard shortcuts

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