log

package
v4.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const MaskedQueryParams = "MaskedQueryParams"
View Source
const MaskedRequestFields = "MaskedRequestFields"
View Source
const MaskedResponseFields = "MaskedResponseFields"
View Source
const (
	MaskedValue = "******"
)

Variables

View Source
var FieldRegexCache = sync.Map{}

Functions

func Attribute

func Attribute(option Option) restful.FilterFunction

Attribute filter is used to define the log attribute for the endpoint.

func MaskFields

func MaskFields(contentType, content, fields string) string

MaskFields will mask the field value on the content string based on the provided field name(s) in "fields" parameter separated by comma.

func MaskQueryParams

func MaskQueryParams(uri string, fields string) string

MaskQueryParams will mask the field value on the uri based on the provided field name(s) in "fields" parameter separated by comma.

Types

type FieldRegex

type FieldRegex struct {
	FieldName          string
	JsonPattern        *regexp.Regexp
	QueryStringPattern *regexp.Regexp
}

FieldRegex contains regex patterns for field name in varied content-types.

func (*FieldRegex) InitFieldRegex

func (f *FieldRegex) InitFieldRegex(fieldName string)

InitFieldRegex initialize the FieldRegex along with its regex patterns.

type Option

type Option struct {
	// Query param that need to masked in url, separated with comma
	MaskedQueryParams string
	// Field that need to masked in request body, separated with comma
	MaskedRequestFields string
	// Field that need to masked in response body, separated with comma
	MaskedResponseFields string
}

Option contains attribute options for log functionality

Jump to

Keyboard shortcuts

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