Documentation
¶
Index ¶
- Constants
- Variables
- func AppendToSessionLogFile(sessionId string, filename string, content string) string
- func AppendToStreamSessionLog(sessionId string, requestSeqId int, chunk string) string
- func AppendToStreamSessionLogJson(sessionId string, requestSeqId int, jsonableChunk any) string
- 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 GetSessionPrefix(sessionId string) string
- 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)
- func WriteChatResponseJson(sessionId string, requestSeqId int, response any) string
- func WriteRequestMessage(sessionId string, requestSeqId int, message string) string
- func WriteRequestMessageJson(sessionId string, requestSeqId int, message any) string
- func WriteToolResultsJson(sessionId string, requestSeqId int, toolResults any) string
- type Attr
- type LogData
- type LogMessage
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 AppendToStreamSessionLog ¶ added in v0.0.54
func AppendToStreamSessionLogJson ¶ added in v0.0.54
func DebugPersist ¶
func ErrorPersist ¶
func GetSessionPrefix ¶ added in v0.0.54
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 ¶
func WriteChatResponseJson ¶ added in v0.0.54
func WriteRequestMessage ¶ added in v0.0.54
func WriteRequestMessageJson ¶ added in v0.0.54
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.