logstore

package
v0.0.0-...-6bb069b Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WarnLevel  = "[Warn] "
	InfoLevel  = "[Info] "
	DebugLevel = "[Debug] "
	ErrorLevel = "[Error] "
)
View Source
const (
	LOG_TABLE = "log"
)

Variables

This section is empty.

Functions

func AppendIp

func AppendIp(correlationId string, instanceId string, ip string)

func Debug

func Debug(correlationId string, instanceId string, v ...interface{})

func End

func End(correlationId string, instanceId string)

func Error

func Error(correlationId string, instanceId string, v ...interface{})

func Info

func Info(correlationId string, instanceId string, v ...interface{})

func Start

func Start(correlationId string, instanceId string) bool

func StoreLog

func StoreLog(level string, instanceId string, correlationId string, innerIp string, isSync bool, v ...interface{})

*

  • 日志直接存储

func StoreLogAnsync

func StoreLogAnsync(level string, instanceId string, correlationId string, innerIp string, v ...interface{})

*

  • 日志异步存储

func StoreLogSync

func StoreLogSync(level string, instanceId string, correlationId string, innerIp string, v ...interface{})

*

  • 日志串行存储

func Warn

func Warn(correlationId string, instanceId string, v ...interface{})

Types

type ConcurrentMap

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

func NewConcurrentMap

func NewConcurrentMap(capcity int, kType reflect.Type, vType reflect.Type) *ConcurrentMap

func (*ConcurrentMap) Get

func (cm *ConcurrentMap) Get(k interface{}) interface{}

func (*ConcurrentMap) KeyType

func (cm *ConcurrentMap) KeyType() reflect.Type

func (*ConcurrentMap) Put

func (cm *ConcurrentMap) Put(k interface{}, v interface{}) (bool, error)

func (*ConcurrentMap) Remove

func (cm *ConcurrentMap) Remove(k interface{})

func (*ConcurrentMap) Size

func (cm *ConcurrentMap) Size() int

func (*ConcurrentMap) ValueType

func (cm *ConcurrentMap) ValueType() reflect.Type

type LogInfo

type LogInfo struct {
	InstanceId    string      `json:"instance_id" orm:"pk"`
	CorrelationId string      `json:"correlation_id"`
	Ip            string      `json:"ip"`        //机器ip
	Message       string      `json:"message"`   //日志信息
	Mutex         *sync.Mutex `json:"-" orm:"-"` //互斥锁
}

func NewDefaultLogInfo

func NewDefaultLogInfo(instanceId string, correlationId string) (result *LogInfo)

func NewLogInfo

func NewLogInfo(instanceId string, correlationId string, ip string) (result *LogInfo)

func (*LogInfo) TableName

func (log *LogInfo) TableName() string

type LogInfoRequest

type LogInfoRequest struct {
	InstanceId    string `json:"instance_id"`
	CorrelationId string `json:"correlationId"`
	Ip            string `json:"ip"`
	Msg           string `json:"message;type(text)"`
	Level         int    `json:"level"`
}

type Store

type Store struct {
	LogInfo *LogInfo
}

func (*Store) Debug

func (store *Store) Debug(v ...interface{})

func (*Store) DeleteLog

func (store *Store) DeleteLog(instanceId string, correlation_id string) (result bool)

func (*Store) End

func (store *Store) End() (result bool)

func (*Store) Error

func (store *Store) Error(v ...interface{})

func (*Store) Flush

func (store *Store) Flush() (result bool)

func (*Store) Info

func (store *Store) Info(v ...interface{})

func (*Store) LogMessage

func (store *Store) LogMessage(level string, v ...interface{}) (result bool)

func (*Store) QueryLogByCorrelationIdAndInstanceId

func (store *Store) QueryLogByCorrelationIdAndInstanceId(instanceId string, correlation_id string) (result *LogInfo)

func (*Store) QueryLogByInstanceId

func (store *Store) QueryLogByInstanceId(instanceId string) (result *LogInfo)

func (*Store) Start

func (store *Store) Start(instanceId string, correlation_id string, ip string)

func (*Store) Warn

func (store *Store) Warn(v ...interface{})

Jump to

Keyboard shortcuts

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