Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Add console logging support for Frame Processors #297

Merged
merged 11 commits into from
Jul 30, 2021

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Jul 23, 2021

What

Until now you could not log something to the Metro JS console. The only way to log something was through the native HostFunction _log, which only logged to Xcode Logs/Android Logcat.
This PR changes this and adds support for using console to log messages to the Metro console. (e.g. console.log, console.debug, etc)

When trying to add support for this, I noticed that there were a few threading issues with the way Frame Processors are currently implemented - mainly that they use the reanimated UI Thread Scheduler for scheduling stuff, which (afaik) should only be a problem when you passed a function to a FP Plugin. But this PR fixes this by implementing a custom Scheduler.

Changes

Tested on

  • iPhone 11 Pro
  • Android Simulator

Related issues

@mrousavy mrousavy changed the title feat: Add console logging support feat: Add console logging support for Frame Processors Jul 23, 2021
@mrousavy mrousavy added ☕️ js Affects the JS/TS codebase ✨ feature Proposes a new feature or enhancement 🍏 ios Issue affects the iOS platform 🐛 bug Something isn't working 🤖 android Issue affects the Android platform labels Jul 25, 2021
@mrousavy mrousavy force-pushed the feat/console-logging-js branch from d3fc10a to ece0fc5 Compare July 26, 2021 09:34
@mrousavy
Copy link
Owner Author

@mrousavy
Copy link
Owner Author

Possibly also waiting for software-mansion/react-native-reanimated#2220

@mrousavy mrousavy force-pushed the feat/console-logging-js branch from d8015d2 to b5c8f49 Compare July 30, 2021 07:50
@mrousavy mrousavy merged commit 0f7ee51 into main Jul 30, 2021
@mrousavy mrousavy deleted the feat/console-logging-js branch July 30, 2021 08:27
isaaccolson pushed a commit to isaaccolson/deliveries-mobile that referenced this pull request Oct 30, 2024
* Try to log to console via runOnJS

* Call `console.log`

* Create custom `VisionCameraScheduler`

* Fix scheduler call

* Call with this

* Fix console setting

* Move J---- to `java-bindings`

* c++ style

* Android: 1/2 Create custom Scheduler

* Android: 2/2 Use custom Scheduler

* Don't use `runOnJS`, use `__callAsync` directly
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🤖 android Issue affects the Android platform 🐛 bug Something isn't working ✨ feature Proposes a new feature or enhancement 🍏 ios Issue affects the iOS platform ☕️ js Affects the JS/TS codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant