Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(ctx context.Context, value ...interface{})
- func Debugf(ctx context.Context, format string, value ...interface{})
- func Error(ctx context.Context, value ...interface{})
- func Errorf(ctx context.Context, format string, value ...interface{})
- func Fatal(ctx context.Context, value ...interface{})
- func Fatalf(ctx context.Context, format string, value ...interface{})
- func GetInComeHeader(ctx context.Context) metadata.MD
- func GetOutHeader(ctx context.Context) metadata.MD
- func GetServiceName(ctx context.Context) string
- func GetTraceID(ctx context.Context) (string, error)
- func GinLogger() gin.HandlerFunc
- func GinRecovery(stack bool) gin.HandlerFunc
- func Info(ctx context.Context, value ...interface{})
- func Infof(ctx context.Context, format string, value ...interface{})
- func Init(mode string) (err error)
- func Warn(ctx context.Context, value ...interface{})
- func Warnf(ctx context.Context, format string, value ...interface{})
- func WriteHeader(ctx *context.Context, key string, value string) (context.Context, error)
- type BlameLine
- type Callback
- type Header
- type LogConfig
Constants ¶
View Source
const ( // TraceIDKey TODO TraceIDKey key = 100 TraceStringKey string = "traceid" )
Variables ¶
View Source
var MaxLineSize = 1024
MaxLineSize is the maximum of one line of output. testing with 1K which seems OK
Functions ¶
func GetServiceName ¶ added in v0.0.4
GetServiceName TODO
func GetTraceID ¶ added in v0.0.4
GetTraceID return uin+seq as an unique trace_id
func GinRecovery ¶
func GinRecovery(stack bool) gin.HandlerFunc
GinRecovery recover掉项目可能出现的panic,并使用zap记录相关日志
Types ¶
type BlameLine ¶
type BlameLine struct { AuthorName string AuthorEmail string AuthorDate time.Time CommitName string CommitEmail string CommitDate time.Time }
BlameLine is a structure for a blame result for a specific user
type LogConfig ¶
type LogConfig struct { Level string `mapstructure:"level" json:"level"` Filename string `mapstructure:"filename" json:"filename"` MaxSize int `mapstructure:"max_size" json:"max_size"` MaxAge int `mapstructure:"max_age" json:"max_age"` MaxBackups int `mapstructure:"max_backups" json:"max_backups"` }
Click to show internal directories.
Click to hide internal directories.