Documentation
¶
Index ¶
- Constants
- func Close()
- func CollectChildStderr(stderr io.Reader, tags ...any) string
- func Debug(msg string, args ...any)
- func Error(msg string, args ...any)
- func ErrorCtx(ctx context.Context, msg string, args ...any)
- func GetGlobalLogger() *zap.Logger
- func Info(msg string, args ...any)
- func Init(cfg Config)
- func NewLogger(cfg Config) (*zap.Logger, error)
- func ReportExitError(w io.Writer, err error) bool
- func SetGlobalLogger(l *zap.Logger)
- func Warn(msg string, args ...any)
- func WarnCtx(ctx context.Context, msg string, args ...any)
- type Config
- type Problem
Constants ¶
const ChildStderrJSONEnv = "INFER_LOG_STDERR_JSON"
ChildStderrJSONEnv is the environment variable the daemon sets on the processes it starts. A child process then logs JSON to stderr and keeps no log file of its own: the daemon collects its stderr into the daemon log.
Variables ¶
This section is empty.
Functions ¶
func CollectChildStderr ¶ added in v0.219.0
CollectChildStderr logs one started child process's stderr into this process's log, one entry per line, enriched with the collector's tags (typically project_dir, conversation_id and worker_pid). It returns once the child's stderr closes, with the child's failure: the error it reported through ReportExitError, or else whatever plain lines it wrote. Plain lines are logged as one warning per child.
func ErrorCtx ¶ added in v0.207.0
ErrorCtx logs an error carrying the OTel trace context of ctx; see WarnCtx.
func GetGlobalLogger ¶
GetGlobalLogger returns the global logger instance Useful for services that need to store a logger reference
func ReportExitError ¶ added in v0.222.0
ReportExitError writes a failed command's error as one JSON log line on stderr when this process was started by the daemon, so the parent collects the whole message. It reports false when the error should be printed for a person instead.
func SetGlobalLogger ¶
SetGlobalLogger swaps the global logger (and its sugared form). It is primarily a test seam: tests build a logger over an observed core to assert what was logged. Passing nil is a no-op.
Types ¶
type Config ¶
type Config struct {
Verbose bool
Debug bool
LogDir string
Stdout bool
ArchiveEnabled bool
ArchiveMaxSizeMB int
FilePrefix string
}
Config for logger initialization
type Problem ¶ added in v0.254.0
type Problem struct {
Time time.Time
Severity string
Message string
Detail string
ConversationID string
}
Problem is one warning or error this process logged, reduced to what a reader needs: no caller, no stack trace and no fields but the error itself and the conversation it belongs to.
func ProblemsSince ¶ added in v0.254.0
ProblemsSince lists the warnings and errors this process logged from moment on, oldest first. It reaches back at most maxRecentProblems entries.