mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
db9fc38893
Summary: People ask "How do you use `console.log` with React Native?" and there is no good answer. This diff aims to stop people from asking this question. See https://fb.workplace.com/groups/rn.core/permalink/2372327062999018/ for context. This logging relies on network requests which can cause logs to show up out-of-order. To reduce the likelihood I queue every log message on the server for a maximum of 200ms. There could be other methods, like using websocket, but that seems more complex than is necessary at least in the beginning. I considered various throttling strategies because this could be quite chatty and possibly problematic, however I think we can just ship this and iterate based on feedback. On my very underpowered laptop I logged a random number every 10 milliseconds and it didn't cause any issues or slowdown. Reviewed By: gaearon Differential Revision: D15559151 fbshipit-source-id: 552001622af0937ae3a37d2bd8c1b96e7ca52020