Documentation ¶
Index ¶
- Constants
- func ApplyParam(p Param, entry wlog.LogEntry)
- func SetDefaultLoggerCreator(creator func() Logger)
- func ToParams(name string, result AuditResultType, inParams []Param) []wlog.Param
- func WithLogger(ctx context.Context, logger Logger) context.Context
- func WithLoggerParams(ctx context.Context, params ...Param) context.Context
- type AuditResultType
- type Logger
- type Param
- func OrgID(orgID string) Param
- func Origin(origin string) Param
- func OtherUIDs(otherUIDs ...string) Param
- func RequestParam(key string, value interface{}) Param
- func RequestParams(requestParams map[string]interface{}) Param
- func ResultParam(key string, value interface{}) Param
- func ResultParams(resultParams map[string]interface{}) Param
- func SID(sid string) Param
- func TokenID(tokenID string) Param
- func TraceID(traceID string) Param
- func UID(uid string) Param
Constants ¶
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 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 ¶
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
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" AuditResultError AuditResultType = "ERROR" )
type Logger ¶
type Logger interface {
Audit(name string, result AuditResultType, params ...Param)
}
func FromContext ¶
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 NewFromCreator ¶
func NewFromCreator(w io.Writer, creator wlog.LoggerCreator) Logger
func WithParams ¶
type Param ¶
type Param interface {
// contains filtered or unexported methods
}