It's time to upgrade RCTDefaultLogFunction to use modern os_log API
See original GitHub issueCurrently, the default logger outputs directly to stderr. This renders log collection using Apple’s log stream
API broken, as stderr output is not collected by the Apple logging system. For example, in Detox, we collect the device logs when running a test, but anything logged from the JS is not collected.
It’s time to upgrade this behavior by using the Apple Unified Logging API. As an added bonus, the system logging API has log levels similar to those of RCTLogLevel
, which can be mapped to the system log levels.
I am willing to write a PR for this once there is an agreement on the solution.
Thanks
React Native version: 0.61.2 -> master
Steps To Reproduce
console.log()
in JavaScript- Look for the log in the Console.app or using
log stream
command
Describe what you expected to happen: The logged text should appear in the Console.app
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:7 (7 by maintainers)
Top Results From Across the Web
OSLog | Apple Developer Forums
I understand that Logger is the preferred method now instead of os_log, but both should echo the log messages on XCode debug console...
Read more >OSLog and Unified logging as recommended by Apple
Using Apple's recommended unified logging system using OSLog can be done in just a few steps. Learn how to use it in combination...
Read more >iOS 14's New Logger API vs. OSLog - Better Programming
OSLog. At WWDC 20, Apple announced a new unified logging API to gather, process log messages, and help debug unexpected behavior.
Read more >Logging in Swift | steipete's blog
Exploring the new Swift Logger struct, OSLogStore, and streaming access to OSLog.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you!
Great, since we have an agreement, I’ll write and submit a PR soon. Thanks