Documentation ¶
Index ¶
- Constants
- Variables
- func AddField(c *gin.Context, field ...Field)
- func CloseLogger()
- func DebugLogger(ctx *gin.Context, msg string, fields ...zap.Field)
- func Debugf(ctx *gin.Context, format string, args ...interface{})
- func Error(ctx *gin.Context, args ...interface{})
- func ErrorLogger(ctx *gin.Context, msg string, fields ...zap.Field)
- func Errorf(ctx *gin.Context, format string, args ...interface{})
- func FatalLogger(ctx *gin.Context, msg string, fields ...zap.Field)
- func GetFormatRequestTime(time time.Time) string
- func GetLogger() (s *zap.SugaredLogger)
- func GetRequestCost(start, end time.Time) float64
- func GetRequestID(ctx *gin.Context) string
- func GetRequestUri(ctx *gin.Context) string
- func GetZapLogger() (l *zap.Logger)
- func Info(ctx *gin.Context, args ...interface{})
- func InfoLogger(ctx *gin.Context, msg string, fields ...zap.Field)
- func Infof(ctx *gin.Context, format string, args ...interface{})
- func InitLog(moduleName string, conf LogConfig) *zap.SugaredLogger
- func NewRand(seed int64) *rand.Rand
- func Panic(ctx *gin.Context, args ...interface{})
- func PanicLogger(ctx *gin.Context, msg string, fields ...zap.Field)
- func Panicf(ctx *gin.Context, format string, args ...interface{})
- func RegisterJSONEncoder(moduleName string) error
- func SetLogFlag(ctx *gin.Context)
- func SetNoLogFlag(ctx *gin.Context)
- func Warn(ctx *gin.Context, args ...interface{})
- func WarnLogger(ctx *gin.Context, msg string, fields ...zap.Field)
- func Warnf(ctx *gin.Context, format string, args ...interface{})
- type Buffer
- type Field
- type LockedSource
- type LogConfig
- type Logger
Constants ¶
View Source
const ( ContextKeyRequestID = "Tiant_Request_Id" ContextKeyNoLog = "_no_log" ContextKeyUri = "_uri" )
util key
Variables ¶
View Source
var ( Binary = zap.Binary Bool = zap.Bool ByteString = zap.ByteString String = zap.String Strings = zap.Strings Float64 = zap.Float64 Float32 = zap.Float32 Int = zap.Int Int64 = zap.Int64 Int32 = zap.Int32 Int16 = zap.Int16 Int8 = zap.Int8 Uint = zap.Uint Uint64 = zap.Uint64 Uint32 = zap.Uint32 Reflect = zap.Reflect Namespace = zap.Namespace Duration = zap.Duration Object = zap.Object Any = zap.Any Skip = zap.Skip() AddCallerSkip = zap.AddCallerSkip )
View Source
var ( SugaredLogger *zap.SugaredLogger ZapLogger *zap.Logger )
Functions ¶
func CloseLogger ¶
func CloseLogger()
func GetFormatRequestTime ¶
func GetLogger ¶
func GetLogger() (s *zap.SugaredLogger)
func GetRequestCost ¶
func GetRequestID ¶
func GetRequestUri ¶
func GetZapLogger ¶
func RegisterJSONEncoder ¶
func SetLogFlag ¶
func SetNoLogFlag ¶
Types ¶
type Buffer ¶
type Buffer struct { Switch string `yaml:"switch"` Size int `yaml:"size"` FlushInterval time.Duration `yaml:"flushInterval"` }
对用户暴露的log配置
type LockedSource ¶
type LockedSource struct {
// contains filtered or unexported fields
}
func (*LockedSource) Int63 ¶
func (r *LockedSource) Int63() (n int64)
func (*LockedSource) Seed ¶
func (r *LockedSource) Seed(seed int64)
Seed implements Seed() of Source
Click to show internal directories.
Click to hide internal directories.