sls

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel = iota - 1
	InfoLevel
	WarnLevel
	ErrorLevel
	DPanicLevel
	PanicLevel
	FatalLevel
)

Variables

This section is empty.

Functions

func InitProducer

func InitProducer(config SlsConfig) *producer.Producer

Types

type Level

type Level int8

func (Level) String

func (l Level) String() string

type QuickSls

type QuickSls struct {
	Sls          *Sls
	PClient      *producer.Producer
	AppName      string
	DefaultLevel Level
}

func NewQuickSls

func NewQuickSls(c SlsConfig, appName string) *QuickSls

func (QuickSls) Log

func (qs QuickSls) Log(ip string, level Level, info QuickTemplate) error

type QuickTemplate

type QuickTemplate struct {
	RequestId string
	Message   string
	Method    string
	Path      string
	Data      string
}

type Sls

type Sls struct {
	Producer *producer.Producer
	Config   SlsConfig
}

func NewSls

func NewSls(c SlsConfig) *Sls

func (Sls) Log

func (s Sls) Log(pclient *producer.Producer, ip string, level Level, template Template) error

type SlsConfig

type SlsConfig struct {
	Endpoint        string
	AccessKeyID     string
	AccessKeySecret string
	ProjectName     string
	LogStoreName    string
}

type Template

type Template struct {
	AppName   string
	RequestId string
	Timestamp int64
	Message   string
	Method    string
	Path      string
	Data      string
}

Jump to

Keyboard shortcuts

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