logger

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	LogDomain = "lowcode_func_log"

	NormalLog      = 1
	AggregationLog = 2

	LogLevelError = 4
	LogLevelWarn  = 5
	LogLevelInfo  = 6

	LogCountLimit     = 10000
	LogLengthLimit    = 10000
	LogLengthLimitTip = `\n... The log has been truncated because it exceeds the length limit.`
	LogCountLimitTip  = `The log has been discarded because it exceeded the limit of  10000`
)

Variables

This section is empty.

Functions

func CompressForDeflate

func CompressForDeflate(b []byte) (string, error)

func Send

func Send(ctx context.Context, l *Logger)

func SetFunctionLoggerExtraToCtx

func SetFunctionLoggerExtraToCtx(ctx context.Context, extra FunctionLoggerExtra) context.Context

func SetLogger

func SetLogger(ctx context.Context, l *Logger) context.Context

func TimeNowMils

func TimeNowMils() int64

Types

type ExtraInfo

type ExtraInfo struct {
	FunctionVersionID int64        `json:"functionVersionID"`
	SourceLabel       structs.I18n `json:"sourceLabel"`
	ObjectLabel       structs.I18n `json:"objectLabel"`
	TriggerTimeCost   int64        `json:"triggerTimeCost"`
	RuntimeCost       int64        `json:"runtimeCost"`
}

type FunctionLoggerExtra

type FunctionLoggerExtra struct {
	FunctionLabel     structs.I18n `json:"functionLabel"`
	SourceID          string       `json:"sourceID"`
	SourceLabel       structs.I18n `json:"sourceLabel"`
	FunctionVersionID int64        `json:"functionVersionID"`
	ObjectLabel       structs.I18n `json:"objectLabel"`
	InstanceID        int64        `json:"instanceID"`
	StartTriggerTime  int64        `json:"startTriggerTime"`
}

FunctionLoggerExtra Only Logger 使用的参数

type I18nTag

type I18nTag struct {
	Key   string       `json:"key"`
	Value structs.I18n `json:"value"`
}

type Log

type Log struct {
	Domain     string    `json:"domain"`
	Type       int       `json:"type"`
	Level      int       `json:"level"`
	CreateTime int64     `json:"createTime"`
	RequestID  string    `json:"RequestID"`
	Sequence   int64     `json:"sequence"`
	Content    string    `json:"content"`
	Tags       []Tag     `json:"tags"`
	TagsI18n   []I18nTag `json:"tagsI18n"`
	ExtraInfo  ExtraInfo `json:"extraInfo"`
}

type Logger

type Logger struct {
	RequestID string
	// contains filtered or unexported fields
}

func GetLogger

func GetLogger(ctx context.Context) *Logger

func NewConsoleLogger added in v0.0.23

func NewConsoleLogger(ctx context.Context) *Logger

func NewLogger

func NewLogger(ctx context.Context) *Logger

func (*Logger) Errorf

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

func (*Logger) Infof

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

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

type StreamLog added in v0.0.28

type StreamLog struct {
	Level      string `json:"k_log_level"`
	CreateTime int64  `json:"k_create_time"`
	RequestID  string `json:"k_requestid"`
	LogID      string `json:"logid"`
	Content    string `json:"content"`
	ServiceID  string `json:"k_microservice_id"`
	EventID    string `json:"k_event_id"`
	Index      int64  `json:"k_log_index"`
}

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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