Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 852 Bytes

zlog.md

File metadata and controls

64 lines (43 loc) · 852 Bytes

zlog

-- import "github.com/andy-zhangtao/gogather/zlog"

Usage

type Zlog

type Zlog struct {
}

func GetZlog

func GetZlog() *Zlog

GetZlog 获取跟踪ID实例

Example
    z := zlog.GetZlog()
    logrus.WithFields(z.Fields(logrus.Fields{"key": value})).Info("main")

func (*Zlog) AddID

func (this *Zlog) AddID(id string) *Zlog

AddID 手动添加跟踪ID.

func (*Zlog) Clean

func (this *Zlog) Clean()

Clean 清除跟踪ID

func (*Zlog) Error

func (this *Zlog) Error(str string) error

func (*Zlog) Fields

func (this *Zlog) Fields(f map[string]interface{}) map[string]interface{}

Fields 在提供的f基础上增加跟踪ID

func (*Zlog) MyTrack

func (this *Zlog) MyTrack() string

MyTrack 获取当前跟踪ID