Documentation
¶
Index ¶
- Variables
- func CTXTransfer(ctx *gin.Context) context.Context
- func CopyCTX(ctx context.Context, headers CopyHeader, keys ...string)
- func GINRequestID(ctx *gin.Context) zap.Field
- func GenRequestID(ctx context.Context) context.Context
- func GinLogger() gin.HandlerFunc
- func GinRecovery() gin.HandlerFunc
- func HeadAdd(header *http.Header, id string)
- func New(conf *Config) error
- func NewGorm(writer *zap.SugaredLogger, config lg.Config) lg.Interface
- func ReentryRequestID(ctx context.Context, id string) context.Context
- func STDRequestID(ctx context.Context) zap.Field
- func Sync()
- type Config
- type CopyHeader
- type Gorm
- func (l Gorm) Error(ctx context.Context, msg string, data ...interface{})
- func (l Gorm) Info(ctx context.Context, msg string, data ...interface{})
- func (l *Gorm) LogMode(level lg.LogLevel) lg.Interface
- func (l Gorm) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l Gorm) Warn(ctx context.Context, msg string, data ...interface{})
- type Sampling
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Logger logger Logger *zap.SugaredLogger )
Functions ¶
func CTXTransfer ¶
CTXTransfer transfer requestID from gin.context to context.Context
func CopyCTX ¶
func CopyCTX(ctx context.Context, headers CopyHeader, keys ...string)
CopyCTX CopyCTX
func GINRequestID ¶
GINRequestID get request id from gin context
func GenRequestID ¶
GenRequestID gen requestID
func ReentryRequestID ¶
ReentryRequestID reentry requestID
func STDRequestID ¶
STDRequestID get request id from std context
Types ¶
type Config ¶
type Config struct { Level int `yaml:"level"` Development bool `yaml:"development"` Sampling Sampling `yaml:"sampling"` OutputPath []string `yaml:"outputPath"` ErrorOutputPath []string `yaml:"errorOutputPath"` }
Config config
type CopyHeader ¶
CopyHeader CopyHeader
func STDHeader ¶
func STDHeader(ctx context.Context) CopyHeader
STDHeader get User-ID ,Role,User-Name,Department-Id from std context
Click to show internal directories.
Click to hide internal directories.