Documentation
¶
Overview ¶
Package logging configures structured logging via log/slog with optional log-file rotation via lumberjack.
Index ¶
Constants ¶
View Source
const MaxPromptPreviewChars = 40
View Source
const MaxPromptPreviewWords = 8
Variables ¶
This section is empty.
Functions ¶
func DefaultLogPath ¶
func DefaultLogPath() string
DefaultLogPath returns the standard daemon log file location.
func ParseLevel ¶
ParseLevel maps a string to an slog.Level. Unrecognised values map to LevelInfo.
func PromptPreview ¶
func Setup ¶
Setup creates and returns a configured *slog.Logger and sets it as the slog default.
ModeForeground produces a TextHandler writing to stderr. ModeService produces a JSONHandler writing to a lumberjack-rotated log file. If the log directory cannot be created in ModeService, it falls back to JSON on stderr.
Types ¶
type TaskLifecycleLogEvent ¶
type TaskLifecycleLogEvent struct {
Event string `json:"event"`
Phase string `json:"phase"`
Status string `json:"status,omitempty"`
TaskID string `json:"taskId,omitempty"`
SessionID string `json:"sessionId,omitempty"`
ChannelID string `json:"channelId,omitempty"`
RequestID string `json:"requestId,omitempty"`
TraceID string `json:"traceId,omitempty"`
AttemptID string `json:"attemptId,omitempty"`
AttemptNumber int `json:"attemptNumber,omitempty"`
TurnKind string `json:"turnKind,omitempty"`
ElapsedMs int64 `json:"elapsedMs,omitempty"`
Model string `json:"model,omitempty"`
Provider string `json:"provider,omitempty"`
PID int `json:"pid,omitempty"`
FailureCode string `json:"failureCode,omitempty"`
Retryable bool `json:"retryable,omitempty"`
PromptPreview string `json:"promptPreview,omitempty"`
Cleanup string `json:"cleanup,omitempty"`
}
func NewTaskLifecycleLog ¶
func NewTaskLifecycleLog(input TaskLifecycleLogInput) TaskLifecycleLogEvent
type TaskLifecycleLogInput ¶
type TaskLifecycleLogInput struct {
Phase string
Status string
TaskID string
SessionID string
ChannelID string
RequestID string
TraceID string
AttemptID string
AttemptNumber int
TurnKind string
ElapsedMs int64
Model string
Provider string
PID int
FailureCode string
Retryable bool
PromptText string
Cleanup string
}
Click to show internal directories.
Click to hide internal directories.