Documentation
¶
Index ¶
- func DefaultLogPath(dir string) string
- func ErrorData(message string, details map[string]any) map[string]any
- func GraderResultData(graderName, graderType string, passed bool, score float64, feedback string) map[string]any
- func RenderTimeline(w io.Writer, events []Event)
- func SessionCompleteData(totalTests, passed, failed, errors int, durationMs int64) map[string]any
- func SessionStartData(specPath, model, engine string, taskCount int) map[string]any
- func TaskCompleteData(taskName, status string, score float64, durationMs int64) map[string]any
- func TaskStartData(taskName string, taskNum, totalTasks int) map[string]any
- type Event
- type EventType
- type JSONLogger
- type Logger
- type NopLogger
- type SessionFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLogPath ¶
DefaultLogPath returns a timestamped session log path inside dir.
func GraderResultData ¶
func GraderResultData(graderName, graderType string, passed bool, score float64, feedback string) map[string]any
GraderResultData returns event data for a grader result.
func RenderTimeline ¶
RenderTimeline writes a human-readable session timeline to w.
func SessionCompleteData ¶
SessionCompleteData returns event data for a session end.
func SessionStartData ¶
SessionStartData returns event data for a session start.
func TaskCompleteData ¶
TaskCompleteData returns event data for a task completion.
Types ¶
type Event ¶
type Event struct {
Timestamp time.Time `json:"timestamp"`
Type EventType `json:"type"`
Data map[string]any `json:"data,omitempty"`
}
Event is a single timestamped entry in a session log.
func ReadEvents ¶
ReadEvents parses all events from a session log file.
type JSONLogger ¶
type JSONLogger struct {
// contains filtered or unexported fields
}
JSONLogger writes events as newline-delimited JSON (NDJSON).
func NewJSONLogger ¶
func NewJSONLogger(path string) (*JSONLogger, error)
NewJSONLogger creates a logger that writes NDJSON to the given path. Parent directories are created automatically.
func (*JSONLogger) Close ¶
func (l *JSONLogger) Close() error
Close flushes and closes the underlying file.
func (*JSONLogger) Log ¶
func (l *JSONLogger) Log(event Event) error
Log writes a single event as one JSON line.
func (*JSONLogger) Path ¶
func (l *JSONLogger) Path() string
Path returns the file path of the session log.
type NopLogger ¶
type NopLogger struct{}
NopLogger discards all events. Useful as a default when logging is disabled.
type SessionFile ¶
SessionFile represents a session log file on disk.
func ListSessions ¶
func ListSessions(dir string) ([]SessionFile, error)
ListSessions finds .jsonl session log files in dir.