log

package
v0.0.0-...-5a37ffa Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CRITICAL = iota
	ERROR
	WARNING
	INFO
	DEBUG

	LevelMax
)
View Source
const (
	WR_LOG_CODE_SUCC      = 0
	WR_LOG_CODE_INPUT_ERR = 1
	WR_LOG_CODE_FULL      = 2
)
View Source
const (
	BATCH_SEND_NUM = 5
)
View Source
const (
	MAX_BUF_LEN = 10240
)
View Source
const (
	NIL_PARENT = "nil"
)

Variables

This section is empty.

Functions

func Count

func Count() string

获取日志的统计

func Critical

func Critical(args ...interface{})

func Criticalf

func Criticalf(format string, args ...interface{})

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func Init

func Init(srvID string, conf *Config, kconf *kafka.Config) (err error)

func PanicTraceLog

func PanicTraceLog(kb int) string

func Print

func Print(args ...interface{})

func Printf

func Printf(format string, args ...interface{})

func Println

func Println(args ...interface{})

func Warning

func Warning(args ...interface{})

func Warningf

func Warningf(format string, args ...interface{})

func Write

func Write(topic string, msg string) int

Types

type Config

type Config struct {
	Topic string         // kafka服务器地址
	Level int            // 发送超时时间, 单位毫秒
	Print int            // 重传次数, 消息系统里面快速失败,不保证数据的高可到达性
	TimeZ *time.Location //时区:time zone
}

type CountST

type CountST struct {
	// contains filtered or unexported fields
}

func (*CountST) BufErr

func (my *CountST) BufErr()

func (*CountST) RecvLog

func (my *CountST) RecvLog()

func (*CountST) SendErr

func (my *CountST) SendErr()

func (*CountST) SendLog

func (my *CountST) SendLog()

type TraceInfoST

type TraceInfoST struct {
	ParentID int64 `json:"parent_id"` //用于标识同一个服务的所有log,便于同一个服务名下的不同服务,IP不安全
	SpanID   int64 `json:"span_id"`   //自己的调用链ID,比如和connID对应
	TraceID  int64 `json:"trace_id"`  //用于标识本次请求,比如一个消息一个traceID
	FlowID   int64 `json:"flow_id"`   //处理流程模块的ID,便于分模块检查日志,比如io:1, logic:2

}

func NewLogTrace

func NewLogTrace(traceid, spanid, parentid int64) (trace *TraceInfoST)

NewLogTrace ParentID :用于标识同一条连接的所有请求, SpanID : 自己的调用链ID, TraceID : 用于标识本次请求

func (*TraceInfoST) Critical

func (p *TraceInfoST) Critical(args ...interface{})

func (*TraceInfoST) Criticalf

func (p *TraceInfoST) Criticalf(format string, args ...interface{})

func (*TraceInfoST) Debug

func (p *TraceInfoST) Debug(args ...interface{})

func (*TraceInfoST) Debugf

func (p *TraceInfoST) Debugf(format string, args ...interface{})

func (*TraceInfoST) Error

func (p *TraceInfoST) Error(args ...interface{})

func (*TraceInfoST) Errorf

func (p *TraceInfoST) Errorf(format string, args ...interface{})

func (*TraceInfoST) Info

func (p *TraceInfoST) Info(args ...interface{})

func (*TraceInfoST) Infof

func (p *TraceInfoST) Infof(format string, args ...interface{})

func (*TraceInfoST) Print

func (p *TraceInfoST) Print(args ...interface{})

func (*TraceInfoST) Printf

func (p *TraceInfoST) Printf(format string, args ...interface{})

func (*TraceInfoST) Println

func (p *TraceInfoST) Println(args ...interface{})

func (*TraceInfoST) Warning

func (p *TraceInfoST) Warning(args ...interface{})

func (*TraceInfoST) Warningf

func (p *TraceInfoST) Warningf(format string, args ...interface{})

Jump to

Keyboard shortcuts

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