logging

package
v0.0.54 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PersistTimeArg = "$_persist_time"
)

Variables

View Source
var MessageDir string

Message Logging for Debug

Functions

func AppendToSessionLogFile added in v0.0.54

func AppendToSessionLogFile(sessionId string, filename string, content string) string

func AppendToStreamSessionLog added in v0.0.54

func AppendToStreamSessionLog(sessionId string, requestSeqId int, chunk string) string

func AppendToStreamSessionLogJson added in v0.0.54

func AppendToStreamSessionLogJson(sessionId string, requestSeqId int, jsonableChunk any) string

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 GetSessionPrefix added in v0.0.54

func GetSessionPrefix(sessionId string) string

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)

func WriteChatResponseJson added in v0.0.54

func WriteChatResponseJson(sessionId string, requestSeqId int, response any) string

func WriteRequestMessage added in v0.0.54

func WriteRequestMessage(sessionId string, requestSeqId int, message string) string

func WriteRequestMessageJson added in v0.0.54

func WriteRequestMessageJson(sessionId string, requestSeqId int, message any) string

func WriteToolResultsJson added in v0.0.54

func WriteToolResultsJson(sessionId string, requestSeqId int, toolResults any) string

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