Documentation ¶
Index ¶
- func ContextWithTracer(ctx context.Context, tracer Tracer) context.Context
- func Debug(ctx context.Context, format string, a ...interface{})
- func Default(appName string)
- func Error(ctx context.Context, format string, a ...interface{})
- func GinContextWithTracer(ctx *gin.Context, tracer Tracer)
- func GinLogger(appName string) gin.HandlerFunc
- func Info(ctx context.Context, format string, a ...interface{})
- func InfoLevelEnabler() zap.LevelEnablerFunc
- func Init(options ...Option)
- func NewTraceId() string
- func UnaryServerInterceptor(appName string) grpc.UnaryServerInterceptor
- func Warn(ctx context.Context, format string, a ...interface{})
- func WarnLevelEnabler() zap.LevelEnablerFunc
- type Config
- type Logger
- type Option
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithTracer ¶
ContextWithTracer 添加tracer 到context
func GinContextWithTracer ¶
GinContextWithTracer 添加tracer 到context
func InfoLevelEnabler ¶
func InfoLevelEnabler() zap.LevelEnablerFunc
func UnaryServerInterceptor ¶ added in v1.0.2
func UnaryServerInterceptor(appName string) grpc.UnaryServerInterceptor
UnaryServerInterceptor rpc参数
func WarnLevelEnabler ¶
func WarnLevelEnabler() zap.LevelEnablerFunc
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
type Option ¶
type Option func(*Logger)
Option customer option
type Tracer ¶
type Tracer interface { // Finish tracer结束操作 Finish() (self Tracer) // TraceId 获取traceId TraceId() (traceId string) // RequestTime 请求时间 RequestTime() time.Time // ResponseTime 响应时间 ResponseTime() time.Time // ProcessTime 处理时间 ProcessTime() time.Duration }
Tracer 链路跟踪
func GetTracerFromContext ¶
GetTracerFromContext 从context 获取tracer
func GetTracerFromGinContext ¶
GetTracerFromGinContext 从gin context 获取tracer
Click to show internal directories.
Click to hide internal directories.