Documentation
¶
Index ¶
- func Cleanup(dir string, retentionDays int)
- func ClearRunContext()
- func Close()
- func Debug(msg string, args ...any)
- func Error(msg string, args ...any)
- func Info(msg string, args ...any)
- func Init(opts Options) error
- func SetOutput(w io.Writer)
- func SetRunContext(ctx RunContext)
- func Verbose() bool
- func Warn(msg string, args ...any)
- func With(args ...any) *slog.Logger
- type FileWriter
- type Options
- type RunContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearRunContext ¶
func ClearRunContext()
ClearRunContext removes run-scoped attributes from subsequent log messages. Call this when a run ends.
func SetRunContext ¶
func SetRunContext(ctx RunContext)
SetRunContext adds run-scoped attributes to all subsequent log messages. Call this when a run starts to correlate all logs with the run.
Types ¶
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter manages daily log file rotation and symlink updates.
func NewFileWriter ¶
func NewFileWriter(dir string) (*FileWriter, error)
NewFileWriter creates a FileWriter that writes to dir/YYYY-MM-DD.jsonl.
type Options ¶
type Options struct {
// Verbose enables debug/info output to stderr (non-interactive only)
Verbose bool
// JSONFormat uses JSON output format for stderr
JSONFormat bool
// Interactive mode suppresses debug/info to stderr regardless of Verbose
Interactive bool
// DebugDir is the directory for debug log files. If empty, file logging is disabled.
DebugDir string
// RetentionDays is how many days to keep log files (0 = no cleanup)
RetentionDays int
// Stderr is the writer for stderr output (defaults to os.Stderr)
Stderr io.Writer
}
Options configures the logger.
type RunContext ¶
type RunContext struct {
RunID string // Unique run identifier
RunName string // Human-readable name (e.g., "my-project")
Agent string // Agent type (e.g., "claude", "codex")
Workspace string // Project directory basename
Image string // Container image used
Grants []string // Active credential grants
}
RunContext contains run-scoped data to include in all log messages.
Click to show internal directories.
Click to hide internal directories.