react-native-device-log
Description
A debug-view that prints your debug-messages in a neat listview. Supports different levels of log-messages, complex data (With pretty printing), timers for measuring perf and much more. Adheres to a simple, async, protocol for saving messages where you can plug in your own adapter, or use AsyncStorage from React Native to persist log-messages between session. (Or just use simple session in-memory storage).
Also tracks Connectivity of Device and App-State-changes (Background, Idle, Active).
Will also, if you choose to (flag), track exceptions in your app and in React Native and log linenumbers and methods so you can track crashes in production.
Configure how many messages that should be rendered in the ListView and how many messages should be persisted. All built to be efficent and fast.
Install:
npm install react-native-device-log --save
Example:
/** * Sample React Native App width react-native-device-log * https://github.com/facebook/react-native */;; //The device-log contains the public api that you will use in your app.//The LogView is the GUI/Log-list that you can render at desired location //in your app: ; //Call init and set a custom adapter that implements the interface of//AsyncStorage: getItem, removeItem, setItem.//By default the log uses a in-memory object, in this example we//explicitly set the log to use the persistent AsyncStorage instead: deviceLog; //The device-log contains a timer for measuring performance:deviceLog; { //Print the current time of the above timer: deviceLog; //Available log messages: deviceLog; deviceLog; deviceLog; deviceLog; //Print the current time of the above timer again: deviceLog; //Later stop and remove the timer: //Will not print anything. deviceLog; ; } { /* inverted: will write the log inverted. multiExpanded: means that multiple logmessages that are longer then one row can be expanded simultaneously timeStampFormat: moment format for timeStamp */ return <LogView inverted=false multiExpanded=true timeStampFormat='HH:mm:ss'></LogView> ; } AppRegistry;