or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

actors.mdbuilds.mdindex.mdlogging.mdrequest-queues.mdruns.mdschedules.mdstorage.mdstore.mdtasks.mdusers.mdwebhooks.md

logging.mddocs/

0

# Logging

1

2

Log access and streaming for Actor runs and builds with real-time monitoring capabilities. Provides comprehensive access to execution logs and diagnostic information.

3

4

## Capabilities

5

6

### Log Operations

7

8

```python { .api }

9

class LogClient:

10

def get(self, *, raw: bool = False) -> str | None:

11

"""Get log as text.

12

13

Args:

14

raw: Whether to return raw log without formatting

15

"""

16

17

def get_as_bytes(self, *, raw: bool = False) -> bytes | None:

18

"""Get log as raw bytes.

19

20

Args:

21

raw: Whether to return raw log without formatting

22

"""

23

24

def stream(self, *, raw: bool = False) -> Iterator[Response | None]:

25

"""Stream log as context manager.

26

27

Args:

28

raw: Whether to stream raw log without formatting

29

"""

30

31

class LogClientAsync:

32

"""Async version of LogClient with identical methods."""

33

```

34

35

## Usage Examples

36

37

```python

38

from apify_client import ApifyClient

39

40

client = ApifyClient('your-api-token')

41

42

# Get complete log

43

log_client = client.log('run-or-build-id')

44

full_log = log_client.get()

45

print(full_log)

46

47

# Stream log in real-time

48

with log_client.stream() as log_stream:

49

for chunk in log_stream:

50

if chunk:

51

print(chunk.decode('utf-8'), end='')

52

53

# Get raw log bytes for file storage

54

log_bytes = log_client.get_as_bytes(raw=True)

55

with open('actor_log.txt', 'wb') as f:

56

f.write(log_bytes)

57

```