Skip to content

Conversation

@Pijukatel
Copy link

@Pijukatel Pijukatel commented Oct 22, 2025

Description

  • Add convenience methods and arguments for redirecting the streamed actor log to another log.
  • This changes the default behavior in non non-breaking way. By default, the logs will be redirected now.
  • Update log endpoints calls to accept raw parameter.
  • Parity with Python implementation feat: Add redirected actor logs apify-client-python#403

Example usage:

Actor.call - default

This will redirect logs by default. Example default redirected line:

2025-10-22T13:06:39.476Z redirect-log-tester runId:SoK1VRJxG61tVrgNz -> 2025-10-22T13:06:06.686Z ACTOR: Pulling container image of build Gh9yAJtjw0rHpc1NU from registry.

...
await client.actor('redirect-actor-id').call();

Actor.call - custom Log

This will redirect logs using custom log and logger. Example default redirected line:

2025-10-22T13:06:39.476Z customPrefix 2025-10-22T13:06:06.686Z ACTOR: Pulling container image of build Gh9yAJtjw0rHpc1NU from registry.

...
await client.actor('redirect-actor-id').call(someInputs, {
    log: new Log({ level: LEVELS.DEBUG, prefix: 'customPrefix', logger: new LoggerActorRedirect()
    }),

Actor.call - no log redirection

This will disable all log redirection (same as current behavior)

...
await client.actor('redirect-actor-id').call(someInputs, {log: null}),

Actor.run - attaching to already running actor and redirecting new logs

A typical use case is redirecting logs from an Actor that runs in standby. We do not want all the logs; we only want the new logs generated from the moment of connection.

...
const streamedLog = await client.run('someActorRunId').getStreamedLog();
await streamedLog.start();
// Do some stuff while also redirecting logs from another Actor
await streamedLog.stop();

Example actor with recursive redirection:

https://console.apify.com/actors/IcfIKTIvbmujMmovj/source

Issues

@github-actions github-actions bot added this to the 126th sprint - Tooling team milestone Oct 22, 2025
@github-actions github-actions bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Oct 22, 2025
@Pijukatel Pijukatel requested a review from B4nan October 23, 2025 13:24
"url": "https://github.com/apify/apify-client-js/issues"
},
"homepage": "https://docs.apify.com/api/client/js/",
"files": [
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just temp for testing

@B4nan
Copy link
Member

B4nan commented Oct 23, 2025

@barjin @janbuchar can you guys please take a look at this and provide some early feedback? I'll be off tomorrow+monday, so it would have to wait a bit for me.

@barjin barjin self-requested a review October 23, 2025 14:37

export interface ActorCallOptions extends Omit<ActorStartOptions, 'waitForFinish'> {
waitSecs?: number;
log?: Log | null;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference from Python is the name of the argument. While in Python it is called logger and can be of type Logger, here it is log and can be of type Log.

In JS tooling, the Log is a kind of Logger from Python, as it (implicitly) includes level, formatting, and handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants