Reputation: 4341
I'm trying to catch console.log
logs in my React Native app to send the to a remote server (I'm trying Papertrail).
I know they are displayed to stderr
but I want to send them to the Papertrail's server. I managed to send native logs (with the Papertrail's wrapper around CocoaLumberjack) but I don't know how to do this for javascript logs..
I tried to override default NSLog
but React Native's logs uses the low-level API ASL
.
Any ideas ?
Upvotes: 2
Views: 709
Reputation: 6716
You can use RCTAddLogFunction
https://github.com/facebook/react-native/blob/6603cef95cd30fcc05330707d4ce10a2c4e22046/React/Base/RCTLog.h#L107 (or RCTSetLogFunction
) and do what you need with the message.
Upvotes: 2