aggregatelog

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SENTRY_LOG_SERVICENAME  = "sentry"
	ELASTIC_LOG_SERVICENAME = "elastic"

	INFO_LEVEL    = "info"
	ERROR_LEVEL   = "error"
	WARNING_LEVEL = "warning"
	DEBUG_LEVEL   = "debug"
	FATAL_LEVEL   = "fatal"
)
View Source
const LOG_AGGREGATION_INDEX = "log_aggregation"

Variables

View Source
var ELASTIC_URL = os.Getenv("ELASTIC_URL")
View Source
var LogServices = make(map[string]*LogService)
View Source
var SENTRY_DSN = os.Getenv("SENTRY_DSN")

Functions

func CheckLogIndexExisted

func CheckLogIndexExisted(client *elastic.Client, index string) bool

CHECK ELASTIC TABLE LOG INDEX EXIST

func CreateElasticClient

func CreateElasticClient(url string) error

func CreateLogIndex

func CreateLogIndex(client *elastic.Client, index string) error

func InitElastic

func InitElastic(params map[string]interface{}) error

func RegisterService

func RegisterService(serviceName string, service *LogService)

func SendElasticDebug

func SendElasticDebug(message string, params ...interface{}) error

func SendElasticError

func SendElasticError(err error, params ...interface{}) error

func SendElasticFatal

func SendElasticFatal(message string, params ...interface{}) error

func SendElasticMessage

func SendElasticMessage(message string, params ...interface{}) error

func SendElasticWarning

func SendElasticWarning(message string, params ...interface{}) error

func SendMessageToElastic

func SendMessageToElastic(message, level string) error

func ValidateElasticClient

func ValidateElasticClient() error

Types

type CaptureDebug

type CaptureDebug func(message string, params ...interface{}) error

type CaptureError

type CaptureError func(err error, params ...interface{}) error

type CaptureFatal

type CaptureFatal func(message string, params ...interface{}) error

type CaptureMessage

type CaptureMessage func(message string, params ...interface{}) error

type CaptureWarning

type CaptureWarning func(message string, params ...interface{}) error

type InitService

type InitService func(params map[string]interface{}) error

type LogService

type LogService struct {
	InitService    InitService
	CaptureMessage CaptureMessage
	CaptureError   CaptureError
	CaptureDebug   CaptureDebug
	CaptureWarning CaptureWarning
	CaptureFatal   CaptureFatal
}

func GetService

func GetService(serviceName string) (*LogService, error)

type MessageData

type MessageData struct {
	Time     time.Time `json:"time"`
	LogLevel string    `json:"level"`
	Message  string    `json:"message"`
	NodeID   string    `json:"nodeid,omitempty"`
	TestName string    `json:"testname,omitempty"`
}

Jump to

Keyboard shortcuts

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