logging

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PersistTimeArg = "$_persist_time"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

func DebugPersist

func DebugPersist(msg string, args ...any)

func Error

func Error(msg string, args ...any)

func ErrorPersist

func ErrorPersist(msg string, args ...any)

func Info

func Info(msg string, args ...any)

func InfoPersist

func InfoPersist(msg string, args ...any)

func NewWriter

func NewWriter() *writer

func RecoverPanic

func RecoverPanic(name string, cleanup func())

RecoverPanic is a common function to handle panics gracefully. It logs the error, creates a panic log file with stack trace, and executes an optional cleanup function before returning.

func Subscribe

func Subscribe(ctx context.Context) <-chan pubsub.Event[LogMessage]

func Warn

func Warn(msg string, args ...any)

func WarnPersist

func WarnPersist(msg string, args ...any)

Types

type Attr

type Attr struct {
	Key   string
	Value string
}

type LogData

type LogData struct {
	*pubsub.Broker[LogMessage]
	// contains filtered or unexported fields
}

func (*LogData) Add

func (l *LogData) Add(msg LogMessage)

func (*LogData) List

func (l *LogData) List() []LogMessage

type LogMessage

type LogMessage struct {
	ID          string
	Time        time.Time
	Level       string
	Persist     bool          // used when we want to show the mesage in the status bar
	PersistTime time.Duration // used when we want to show the mesage in the status bar
	Message     string        `json:"msg"`
	Attributes  []Attr
}

LogMessage is the event payload for a log message

func List

func List() []LogMessage

Jump to

Keyboard shortcuts

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