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
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.