Documentation
¶
Overview ¶
Package logfollow contains shared CLI log stream follow loops.
Index ¶
- func Deployment(ctx context.Context, deps cliruntime.Deps, w io.Writer, ...) error
- func Runtime(ctx context.Context, deps cliruntime.Deps, w io.Writer, open StreamOpener) error
- func RuntimeWithStreamOpened(ctx context.Context, deps cliruntime.Deps, w io.Writer, open StreamOpener, ...) error
- type CatchUp
- type StreamOpener
- type TerminalCheck
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deployment ¶
func Deployment(ctx context.Context, deps cliruntime.Deps, w io.Writer, stream *api.ProjectLogStream, cancel context.CancelFunc, terminal TerminalCheck, catchUp CatchUp) error
Deployment prints a deployment log stream until the deployment reaches a terminal status, then runs catchUp with the IDs already printed from the stream. If the stream closes before the deployment is terminal, it keeps polling so the catch-up search still runs.
func Runtime ¶
func Runtime(ctx context.Context, deps cliruntime.Deps, w io.Writer, open StreamOpener) error
Runtime follows a runtime log stream until the context is canceled. The backend holds a healthy connection open and tails new events, so a closed stream is treated as a transient disconnect: Runtime reconnects from the last stream cursor — resuming without replaying recent events — until the context is canceled. A failure to open the stream is surfaced to the caller.
func RuntimeWithStreamOpened ¶ added in v0.1.0
func RuntimeWithStreamOpened(ctx context.Context, deps cliruntime.Deps, w io.Writer, open StreamOpener, opened func()) error
RuntimeWithStreamOpened follows runtime logs like Runtime and invokes opened once after the first stream connection succeeds. Callers use this to render API instructions that arrive in the stream response headers before a healthy follow session blocks indefinitely.
Types ¶
type StreamOpener ¶
StreamOpener opens a project log stream, resuming after lastEventID when it is set. logfollow re-invokes it to reconnect a dropped stream from its last cursor.