utils

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LAVA_LOG_DEBUG = iota
	LAVA_LOG_INFO
	LAVA_LOG_WARN
	LAVA_LOG_ERROR
	LAVA_LOG_FATAL
	LAVA_LOG_PANIC
)
View Source
const (
	EventPrefix = "lava_"
)
View Source
const TIMEOUT = 10

Variables

View Source
var (
	TimeoutMutex           = "false"
	TimeoutMutexBoolean, _ = strconv.ParseBool(TimeoutMutex)
)
View Source
var JsonFormat = false

Functions

func AppendUniqueIdentifier

func AppendUniqueIdentifier(ctx context.Context, guid uint64) context.Context

func Deserialize

func Deserialize(raw []byte, data any)

func FormatStringerList

func FormatStringerList[T fmt.Stringer](description string, listToPrint []T) string

func GenerateUniqueIdentifier

func GenerateUniqueIdentifier() uint64

func GetUniqueIdentifier

func GetUniqueIdentifier(ctx context.Context) (guid uint64, found bool)

func LavaFormatDebug

func LavaFormatDebug(description string, attributes ...Attribute) error

func LavaFormatError

func LavaFormatError(description string, err error, attributes ...Attribute) error

func LavaFormatFatal

func LavaFormatFatal(description string, err error, attributes ...Attribute)

func LavaFormatInfo

func LavaFormatInfo(description string, attributes ...Attribute) error

func LavaFormatLog

func LavaFormatLog(description string, err error, attributes []Attribute, severity uint) error

func LavaFormatPanic

func LavaFormatPanic(description string, err error, attributes ...Attribute)

func LavaFormatWarning

func LavaFormatWarning(description string, err error, attributes ...Attribute) error

func LogLavaEvent

func LogLavaEvent(ctx sdk.Context, logger log.Logger, name string, attributes map[string]string, description string)

func LoggingLevel added in v0.4.3

func LoggingLevel(logLevel string)

func Serialize

func Serialize(data any) []byte

func WithUniqueIdentifier

func WithUniqueIdentifier(ctx context.Context, guid uint64) context.Context

Types

type Attribute

type Attribute struct {
	Key   string
	Value interface{}
}

func LogAttr

func LogAttr(key string, value interface{}) Attribute

func StringMapToAttributes

func StringMapToAttributes(details map[string]string) []Attribute

type LavaMutex

type LavaMutex struct {
	SecondsLeft int
	// contains filtered or unexported fields
}

func (*LavaMutex) Lock

func (dm *LavaMutex) Lock()

func (*LavaMutex) TryLock

func (dm *LavaMutex) TryLock() (isLocked bool)

func (*LavaMutex) Unlock

func (dm *LavaMutex) Unlock()

type Lockable

type Lockable interface {
	Lock()
	TryLock() bool
	Unlock()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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