React-Native (Beta) - Full Integration
#
About ShipbookShipBook gives you the power to remotely gather, search and analyze your user logs and exceptions in the cloud, on a per-user & session basis.
#
RequirementsReact Native version 0.63.0 and up.
#
InstallationShipBookSDK is available through: NPM
#
Integrating ShipBook into your codeTo initialize, add the following:
To have a log on each class you need to create a logger:
The usage of the log:
#
Enable Shipbook debug loggingIf your logs weren't uploaded to Shipbook, or you're experiencing some other issue with Shipbook, you can enable Shipbook debug logging to track down the problem.
#
Linking ShipBook to a user’s informationThe SDK allows the option to associate each session with specific user information.
#
Register user:The best practice is to set registerUser before ShipBook.start. It will also work after this point however, it will require an additional api request.
The only required parameter is userId
.
#
LogoutTo logout the user, add the following code to your app’s logout function.
#
ScreenTo log the user’s screen information, add the following code
The best practice is to add this code to viewWillAppear in the view controller.
#
FlushFlush all logs on the device and send them now to the server.
#
Get the UUIDThe SDK creates it's own UUID. So to get the UUID call te following code.
#
Additional Information#
Static Function Alternative to getLoggerYou may use a static function in place of getLogger. This is not recommended and the caveats are listed below. When a static function activates the logger, the tag will become the filename. The usage of the logs:
As mentioned, working with this static logger isn't ideal:
- Performance is slower, especially in cases where the log is closed
- The log’s information is less detailed. Ideally, you should create a logger for each class.
- The Log name can have a name collision with a local Log class.