# LogClient<!-- -->

Sub-client for managing a specific log.

Provides methods to manage logs, e.g. get or stream them. Obtain an instance via an appropriate method on the `ApifyClient` class.

### Hierarchy

* [ResourceClient](https://docs.apify.com/api/client/python/reference/class/ResourceClient.md)
  * *LogClient*

## Index[](#Index)

### Methods

* [\_\_init\_\_](https://docs.apify.com/api/client/python/reference/class/LogClient.md#__init__)
* [get](https://docs.apify.com/api/client/python/reference/class/LogClient.md#get)
* [get_as_bytes](https://docs.apify.com/api/client/python/reference/class/LogClient.md#get_as_bytes)
* [stream](https://docs.apify.com/api/client/python/reference/class/LogClient.md#stream)

### Properties

* [resource_id](https://docs.apify.com/api/client/python/reference/class/LogClient.md#resource_id)

## Methods<!-- -->[](#Methods)

### [](#__init__)\_\_init\_\_

* **\_\_init\_\_**(\*, base_url, public_base_url, http_client, resource_path, client_registry, resource_id, params, api_base_url): None

- Overrides [ResourceClient.\_\_init\_\_](https://docs.apify.com/api/client/python/reference/class/ResourceClient.md#__init__)

  Initialize the resource client.

  ***

  #### Parameters

  * ##### keyword-onlybase_url: str

    API base URL.

  * ##### keyword-onlypublic_base_url: str

    Public CDN base URL.

  * ##### keyword-onlyhttp_client: [HttpClient](https://docs.apify.com/api/client/python/reference/class/HttpClient.md)

    HTTP client for making requests.

  * ##### keyword-onlyresource_path: str

    Resource endpoint path (e.g., 'actors', 'datasets').

  * ##### keyword-onlyclient_registry: [ClientRegistry](https://docs.apify.com/api/client/python/reference/class/ClientRegistry.md)

    Bundle of client classes for dependency injection.

  * ##### optionalkeyword-onlyresource_id: str | None = <!-- -->None

    Optional resource ID for single-resource clients.

  * ##### optionalkeyword-onlyparams: [QueryParams](https://docs.apify.com/api/client/python/reference.md#QueryParams) | None = <!-- -->None

    Optional default parameters for all requests.

  * ##### optionalkeyword-onlyapi_base_url: str | None = <!-- -->None

    Base URL of the API itself, for clients of top-level resources. Defaults to `base_url`.

  #### Returns None

### [](#get)get

* **get**(\*, raw, timeout): str | None

- Retrieve the log as text.

  <https://docs.apify.com/api/v2#/reference/logs/log/get-log>

  404s collapse to `None` only when this client targets a specific log by ID (e.g. `client.log(run_id).get()`). For chained clients without a `resource_id` (e.g. `run.log().get()`), a 404 is ambiguous and propagates.

  ***

  #### Parameters

  * ##### optionalkeyword-onlyraw: bool = <!-- -->False

    If true, the log will include formatting. For example, coloring character sequences.

  * ##### optionalkeyword-onlytimeout: [Timeout](https://docs.apify.com/api/client/python/reference.md#Timeout) = <!-- -->'long'

    Timeout for the API HTTP request.

  #### Returns str | None

  The retrieved log, or None, if it does not exist.

### [](#get_as_bytes)get_as_bytes

* **get_as_bytes**(\*, raw, timeout): bytes | None

- Retrieve the log as raw bytes.

  <https://docs.apify.com/api/v2#/reference/logs/log/get-log>

  404s collapse to `None` only when this client targets a specific log by ID (e.g. `client.log(run_id).get_as_bytes()`). For chained clients without a `resource_id` (e.g. `run.log().get_as_bytes()`), a 404 is ambiguous and propagates.

  ***

  #### Parameters

  * ##### optionalkeyword-onlyraw: bool = <!-- -->False

    If true, the log will include formatting. For example, coloring character sequences.

  * ##### optionalkeyword-onlytimeout: [Timeout](https://docs.apify.com/api/client/python/reference.md#Timeout) = <!-- -->'long'

    Timeout for the API HTTP request.

  #### Returns bytes | None

  The retrieved log as raw bytes, or None, if it does not exist.

### [](#stream)stream

* **stream**(\*, raw, timeout): Generator\[[HttpResponse](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md) | None]

- Retrieve the log as a stream.

  <https://docs.apify.com/api/v2#/reference/logs/log/get-log>

  404s collapse to `None` only when this client targets a specific log by ID (e.g. `client.log(run_id).stream()`). For chained clients without a `resource_id` (e.g. `run.log().stream()`), a 404 is ambiguous and propagates.

  ***

  #### Parameters

  * ##### optionalkeyword-onlyraw: bool = <!-- -->False

    If true, the log will include formatting. For example, coloring character sequences.

  * ##### optionalkeyword-onlytimeout: [Timeout](https://docs.apify.com/api/client/python/reference.md#Timeout) = <!-- -->'long'

    Timeout for the API HTTP request.

  #### Returns Generator\[[HttpResponse](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md) | None]

  The retrieved log as a context-managed streaming `Response`, or None, if it does not exist.

## Properties<!-- -->[](#Properties)

### [](#resource_id)resource_id

resource_id: str | None

Inherited from [ResourceClientBase.resource_id](https://docs.apify.com/api/client/python/reference/class/ResourceClientBase.md#resource_id)

Get the resource ID.
