Documentation ¶
Index ¶
- Constants
- Variables
- func CopyContext(ctx context.Context) context.Context
- func FromSpanIDContext(ctx context.Context) (spanID string, ok bool)
- func FromTraceIDContext(ctx context.Context) (traceID string, ok bool)
- func FromUserIDContext(ctx context.Context) (userID string, ok bool)
- func Init(opts ...Option)
- func InitForViper(conf *viper.Viper)
- func NewSpanIDContext(ctx context.Context, spanID string) context.Context
- func NewTraceIDContext(ctx context.Context, traceID string) context.Context
- func NewUserIDContext(ctx context.Context, userID string) context.Context
- func NewZincSink(uri *url.URL) (zs zap.Sink, err error)
- func RegisterSink()
- func Sync()
- func With(ctx context.Context) *zap.Logger
- func WithGrpcMetadata(ctx context.Context, userID string) context.Context
- func WithRequestContext(req *http.Request, userID string) context.Context
- func WithSugared(ctx context.Context) *zap.SugaredLogger
- type ContextSpanIDKey
- type ContextTraceIDKey
- type ContextUserIDKey
- type Option
- type Options
- type SqlxplusLogger
- func (SqlxplusLogger) Errorf(ctx context.Context, format string, args ...interface{})
- func (SqlxplusLogger) Errorln(ctx context.Context, args ...interface{})
- func (SqlxplusLogger) Printf(ctx context.Context, query string, args ...interface{})
- func (SqlxplusLogger) Println(ctx context.Context, args ...interface{})
- type ZincSink
Constants ¶
View Source
const ( // TraceIDKey 跟踪ID TraceIDKey = "trace_id" // SpanIDKey 请求ID SpanIDKey = "span_id" // UserIDKey 用户ID UserIDKey = "user_id" )
View Source
const ( // XTraceIDKey ... XTraceIDKey = "X-Trace-Id" // XSpanIDKey ... XSpanIDKey = "X-Span-Id" )
Variables ¶
View Source
var ( Standard *zap.Logger Sugared *zap.SugaredLogger )
Functions ¶
func FromSpanIDContext ¶
FromSpanIDContext ...
func FromTraceIDContext ¶
FromTraceIDContext ...
func FromUserIDContext ¶
FromUserIDContext ...
func InitForViper ¶
func NewSpanIDContext ¶
NewSpanIDContext ...
func NewTraceIDContext ¶
NewTraceIDContext ...
func NewUserIDContext ¶
NewUserIDContext ...
func NewZincSink ¶
NewZincSink zinc://username:password@localhost:4080/index?format=json
func RegisterSink ¶
func RegisterSink()
func WithGrpcMetadata ¶
WithGrpcMetadata 从上下文中
func WithRequestContext ¶
WithRequestContext ...
func WithSugared ¶
func WithSugared(ctx context.Context) *zap.SugaredLogger
Types ¶
type ContextSpanIDKey ¶
type ContextSpanIDKey struct{}
type ContextTraceIDKey ¶
type ContextTraceIDKey struct{}
type ContextUserIDKey ¶
type ContextUserIDKey struct{}
type SqlxplusLogger ¶
type SqlxplusLogger struct { }
SqlxplusLogger ...
func (SqlxplusLogger) Errorf ¶
func (SqlxplusLogger) Errorf(ctx context.Context, format string, args ...interface{})
Errorf 错误
func (SqlxplusLogger) Errorln ¶
func (SqlxplusLogger) Errorln(ctx context.Context, args ...interface{})
Errorln 错误
func (SqlxplusLogger) Printf ¶
func (SqlxplusLogger) Printf(ctx context.Context, query string, args ...interface{})
Printf 打印
func (SqlxplusLogger) Println ¶
func (SqlxplusLogger) Println(ctx context.Context, args ...interface{})
Println 打印
Click to show internal directories.
Click to hide internal directories.