Documentation
¶
Index ¶
- Constants
- func Access(ctx context.Context, data AccessLogData)
- func Debug(ctx context.Context, msg string, fields ...KeyValue)
- func Error(ctx context.Context, msg string, fields ...KeyValue)
- func Info(ctx context.Context, msg string, fields ...KeyValue)
- func Inject(ctx context.Context, stuff *Tracer) context.Context
- func SetGlobalLogger(log Logger)
- func UnmarshalTracer(tracer *Tracer, v interface{}) error
- func Warn(ctx context.Context, msg string, fields ...KeyValue)
- type AccessLogData
- type HTTPData
- type KeyValue
- type Logger
- type OptionsTracer
- type Tracer
- type Zap
- func (z *Zap) Access(ctx context.Context, data AccessLogData)
- func (z *Zap) Debug(ctx context.Context, msg string, fields ...KeyValue)
- func (z *Zap) Error(ctx context.Context, msg string, fields ...KeyValue)
- func (z *Zap) Info(ctx context.Context, msg string, fields ...KeyValue)
- func (z *Zap) Warn(ctx context.Context, msg string, fields ...KeyValue)
Constants ¶
View Source
const ( TypeAccessLog = "access_log" TypeSys = "sys" )
Variables ¶
This section is empty.
Functions ¶
func Access ¶
func Access(ctx context.Context, data AccessLogData)
func Inject ¶
Inject Tracer object into context. As Go doc said: https://golang.org/pkg/context/#WithValue Use context Values only for request-scoped data that transits processes and APIs, not for passing optional parameters to functions. https://blog.golang.org/context
func SetGlobalLogger ¶
func SetGlobalLogger(log Logger)
func UnmarshalTracer ¶
Types ¶
type AccessLogData ¶
type Logger ¶
type Logger interface { Debug(ctx context.Context, msg string, fields ...KeyValue) Info(ctx context.Context, msg string, fields ...KeyValue) Warn(ctx context.Context, msg string, fields ...KeyValue) Error(ctx context.Context, msg string, fields ...KeyValue) Access(ctx context.Context, data AccessLogData) }
type OptionsTracer ¶
func WithTag ¶
func WithTag(tag string) OptionsTracer
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
func MustExtract ¶
MustExtract will extract Tracer without false condition. When Tracer is not exist, it will return empty Tracer instead of error.
func NewTracer ¶
func NewTracer(v interface{}, opts ...OptionsTracer) (*Tracer, error)
Click to show internal directories.
Click to hide internal directories.