Documentation ¶
Index ¶
- Constants
- func ApplyParam(p Param, entry wlog.LogEntry)
- func SetDefaultLoggerCreator(creator func() Logger)
- func WithLogger(ctx context.Context, logger Logger) context.Context
- type AuditResultType
- type Logger
- type 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 ¶
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 SetDefaultLoggerCreator ¶
func SetDefaultLoggerCreator(creator func() Logger)
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).
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
}
func RequestParam ¶
func RequestParams ¶
func ResultParam ¶
func ResultParams ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.