audit2log

package
v1.57.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TypeValue = "audit.2"

	OtherUIDsKey     = "otherUids"
	OriginKey        = "origin"
	NameKey          = "name"
	ResultKey        = "result"
	RequestParamsKey = "requestParams"
	ResultParamsKey  = "resultParams"
)

Variables

This section is empty.

Functions

func ApplyParam

func ApplyParam(p Param, entry wlog.LogEntry)

func SetDefaultLoggerCreator

func SetDefaultLoggerCreator(creator func() Logger)

func ToParams added in v1.13.0

func ToParams(name string, result AuditResultType, inParams []Param) []wlog.Param

func WithLogger

func WithLogger(ctx context.Context, logger Logger) context.Context

WithLogger returns a copy of the provided context with the provided Logger included as a value. This operation will replace any logger that was previously set on the context (along with all parameters that may have been set on the logger).

func WithLoggerParams added in v1.40.0

func WithLoggerParams(ctx context.Context, params ...Param) context.Context

WithLoggerParams returns a copy of the provided context whose logger is configured with the provided parameters. If no parameters are provided, the original context is returned unmodified. If the provided context did not have a logger set on it, the returned context will contain the default logger configured with the provided parameters.

Types

type AuditResultType

type AuditResultType string
const (
	AuditResultSuccess      AuditResultType = "SUCCESS"
	AuditResultUnauthorized AuditResultType = "UNAUTHORIZED"
	AuditResultError        AuditResultType = "ERROR"
)

type Logger

type Logger interface {
	Audit(name string, result AuditResultType, params ...Param)
}

func FromContext

func FromContext(ctx context.Context) Logger

FromContext returns the Logger stored in the provided context. If no logger is set on the context, returns the logger created by calling DefaultLogger. If the context contains a TraceID set using wtracing, the returned logger has that TraceID set on it as a parameter.

func New

func New(w io.Writer) Logger

func NewFromCreator

func NewFromCreator(w io.Writer, creator wlog.LoggerCreator) Logger

func WithParams

func WithParams(logger Logger, params ...Param) Logger

type Param

type Param interface {
	// contains filtered or unexported methods
}

func OrgID added in v1.41.0

func OrgID(orgID string) Param

func Origin

func Origin(origin string) Param

func OtherUIDs

func OtherUIDs(otherUIDs ...string) Param

func RequestParam

func RequestParam(key string, value interface{}) Param

func RequestParams

func RequestParams(requestParams map[string]interface{}) Param

func ResultParam

func ResultParam(key string, value interface{}) Param

func ResultParams

func ResultParams(resultParams map[string]interface{}) Param

func SID

func SID(sid string) Param

func TokenID

func TokenID(tokenID string) Param

func TraceID

func TraceID(traceID string) Param

func UID

func UID(uid string) Param

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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