question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It's time to upgrade RCTDefaultLogFunction to use modern os_log API

See original GitHub issue

Currently, 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

  1. console.log() in JavaScript
  2. 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:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
LeoNatancommented, Jan 29, 2020

Thank you!

2reactions
LeoNatancommented, Jan 28, 2020

Great, since we have an agreement, I’ll write and submit a PR soon. Thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found