log

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

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 Debug

func Debug(ctx context.Context, value ...interface{})

func Debugf

func Debugf(ctx context.Context, format string, value ...interface{})

func Error

func Error(ctx context.Context, value ...interface{})

func Errorf

func Errorf(ctx context.Context, format string, value ...interface{})

func Fatal

func Fatal(ctx context.Context, value ...interface{})

func Fatalf

func Fatalf(ctx context.Context, format string, value ...interface{})

func GetInComeHeader added in v0.0.4

func GetInComeHeader(ctx context.Context) metadata.MD

func GetOutHeader added in v0.0.4

func GetOutHeader(ctx context.Context) metadata.MD

func GetServiceName added in v0.0.4

func GetServiceName(ctx context.Context) string

GetServiceName TODO

func GetTraceID added in v0.0.4

func GetTraceID(ctx context.Context) (string, error)

GetTraceID return uin+seq as an unique trace_id

func GinLogger

func GinLogger() gin.HandlerFunc

GinLogger 接收gin框架默认的日志

func GinRecovery

func GinRecovery(stack bool) gin.HandlerFunc

GinRecovery recover掉项目可能出现的panic,并使用zap记录相关日志

func Info

func Info(ctx context.Context, value ...interface{})

func Infof

func Infof(ctx context.Context, format string, value ...interface{})

func Init

func Init(mode string) (err error)

func Warn

func Warn(ctx context.Context, value ...interface{})

func Warnf

func Warnf(ctx context.Context, format string, value ...interface{})

func WriteHeader added in v0.0.4

func WriteHeader(ctx *context.Context, key string, value string) (context.Context, error)

WriteHeader 填充head

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

func FindCommit

func FindCommit(ctx context.Context, fn string, line int, w io.Writer) (current BlameLine, err error)

FindCommit 查询代码提交人

type Callback

type Callback func(line BlameLine) error

Callback is called for each line

type Header struct {
	TraceID string `json:"trace_id"`
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL