flume_log

package
v0.3.7-HA.1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: MIT Imports: 12 Imported by: 0

README

##代码: import . "gitlab.qima-inc.com/shiwei/go_flume_sdk" func test() { l := InitSDK(0) //l := InitSDKByAddr("172.16.3.139:5140", 0) defer Flush() detail := NewDetailInfo() detail.AddLogItem("a", "cccc") detail.AddLogItem("b", 123) l.Info("Info", "a bbb\nddd", detail) }

##demo <158>2016-08-26 12:25:35 shiweideMacBook-Pro-2.local/172.17.10.108 info[57399]: topic=log.tetherbin.main {"type":"Info","tag":"tether start..., version: Ver No Version Provided, build : 2016-08-26 04:25:35.514558343 +0000 UTC, gc go1.6 darwin amd64","platform":"go","level":"info","app":"TetherBin","module":"main","detail":{"extra":[{"aaa":123,"bbb":"ccc"}]}}

##topic生成规则: topic = log.tetherbin.main log: 固定名称 tetherbin: app名字,自动获取,小写 main: logIndex,自动获取,非main package为git中package所处路径的最后一个值, main package则为main,小写


比如main package中logindex为main
gitlab.qima-inc.com/shiwei/TetherSDK中则为tethersdk

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailInfo

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

func NewDetailInfo

func NewDetailInfo(m string) *DetailInfo

func (*DetailInfo) AddKeyValue

func (d *DetailInfo) AddKeyValue(key string, value interface{})

func (*DetailInfo) SetExtraInfo

func (d *DetailInfo) SetExtraInfo(extra interface{})

type ExtraInfo

type ExtraInfo map[string]interface{}

type FlumeClient

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

func NewFlumeClient

func NewFlumeClient(agentIP string) *FlumeClient

func (*FlumeClient) SendLog

func (c *FlumeClient) SendLog(d []byte) error

func (*FlumeClient) Stop

func (c *FlumeClient) Stop()

type FlumeLogger

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

func NewFlumeLogger

func NewFlumeLogger() *FlumeLogger

func NewFlumeLoggerWithAddr

func NewFlumeLoggerWithAddr(agentAddr string) *FlumeLogger

func (*FlumeLogger) Error

func (l *FlumeLogger) Error(logInfo string, detail *DetailInfo) error

func (*FlumeLogger) Info

func (l *FlumeLogger) Info(logInfo string, detail *DetailInfo) error

func (*FlumeLogger) Stop

func (l *FlumeLogger) Stop()

func (*FlumeLogger) Warn

func (l *FlumeLogger) Warn(logInfo string, detail *DetailInfo) error

type LogInfo

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

func NewLogInfo

func NewLogInfo() *LogInfo

func (*LogInfo) Serialize

func (l *LogInfo) Serialize() []byte

func (*LogInfo) String

func (l *LogInfo) String() string

type LogInfoJson

type LogInfoJson struct {
	Type     string      `json:"type"`
	Tag      string      `json:"tag"`
	PlatForm string      `json:"platform"`
	Level    string      `json:"level"`
	App      string      `json:"app"`
	Module   string      `json:"module"`
	Detail   interface{} `json:"detail"`
}

Jump to

Keyboard shortcuts

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