Documentation
¶
Index ¶
- Constants
- func Debug(msg string, args ...any)
- func DebugPersist(msg string, args ...any)
- func Error(msg string, args ...any)
- func ErrorPersist(msg string, args ...any)
- func Info(msg string, args ...any)
- func InfoPersist(msg string, args ...any)
- func NewWriter() *writer
- func RecoverPanic(name string, cleanup func())
- func Subscribe(ctx context.Context) <-chan pubsub.Event[LogMessage]
- func Warn(msg string, args ...any)
- func WarnPersist(msg string, args ...any)
- type Attr
- type LogData
- type LogMessage
Constants ¶
View Source
const (
PersistTimeArg = "$_persist_time"
)
Variables ¶
This section is empty.
Functions ¶
func DebugPersist ¶
func ErrorPersist ¶
func InfoPersist ¶
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 WarnPersist ¶
Types ¶
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
Click to show internal directories.
Click to hide internal directories.