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 ¶
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 ¶
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
Click to show internal directories.
Click to hide internal directories.