pub struct LogClient { /* private fields */ }Expand description
Client for an Actor run or build log.
Implementations§
Source§impl LogClient
impl LogClient
Sourcepub async fn get(&self) -> ApifyClientResult<Option<String>>
pub async fn get(&self) -> ApifyClientResult<Option<String>>
Fetches the entire log as a string, or None if it does not exist.
Uses the default (processed) log format. To request the raw log, use
LogClient::get_with_options. To get the log as raw bytes instead of a String
(e.g. if it is not valid UTF-8), use LogClient::get_bytes.
Sourcepub async fn get_with_options(
&self,
options: LogOptions,
) -> ApifyClientResult<Option<String>>
pub async fn get_with_options( &self, options: LogOptions, ) -> ApifyClientResult<Option<String>>
Fetches the entire log as a string, or None if it does not exist, applying the given
LogOptions (e.g. LogOptions::raw).
Sourcepub async fn get_bytes(&self) -> ApifyClientResult<Option<Vec<u8>>>
pub async fn get_bytes(&self) -> ApifyClientResult<Option<Vec<u8>>>
Fetches the entire log as raw bytes, or None if it does not exist.
The counterpart of LogClient::get for a log that is not valid UTF-8, or when the
caller wants to avoid the lossy-UTF-8 conversion get() applies. Uses the default
(processed) log format; see LogClient::get_bytes_with_options for the raw format.
Sourcepub async fn get_bytes_with_options(
&self,
options: LogOptions,
) -> ApifyClientResult<Option<Vec<u8>>>
pub async fn get_bytes_with_options( &self, options: LogOptions, ) -> ApifyClientResult<Option<Vec<u8>>>
Fetches the entire log as raw bytes, or None if it does not exist, applying the given
LogOptions (e.g. LogOptions::raw). The byte-returning counterpart of
LogClient::get_with_options.
Sourcepub async fn stream(
&self,
) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
pub async fn stream( &self, ) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
Opens a streaming connection to the log, yielding chunks of bytes as they arrive.
This powers real-time log redirection: callers can forward each chunk to their own
logger/stdout while a run is still in progress. The stream completes when the log ends
(i.e. the run finishes) — as long as a new chunk arrives at least every 6 minutes; a run
that legitimately logs nothing for that long errors with
ApifyClientError::Timeout instead.
Uses the default (processed) log format. To stream the raw log, use
LogClient::stream_with_options.
Sourcepub async fn stream_with_options(
&self,
options: LogOptions,
) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
pub async fn stream_with_options( &self, options: LogOptions, ) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
Opens a streaming connection to the log applying the given LogOptions, yielding
chunks of bytes as they arrive.
Like LogClient::stream, but lets the caller request the raw log via
LogOptions::raw (as the reference client’s log redirection does, which streams
{ raw: true }).