run
yarn add mobile-app-debugger
or
npm i mobile-app-debugger --save
It serves for debugging network requests, catching errors and crashes, as well as for viewing logs from a device with the ability to export data to JSON.
add below code in AndroidManifest.xml
file in application
section:
<application
android:usesCleartextTraffic="true"
...
>
...
</application>
// Configure debugger
import { AppDebugger } from 'app-debugger';
AppDebugger.configure({
// debugger client port
port: number;
// optional, ovewrrite default console behavior and send logs to debugger client
isOverwriteConsole: boolean;
});
💡 will soon have functionality for automatic catching of requests to the network
// Send network data to debbuger client
AppDebugger.network({
url: string;
method: string;
status: number;
// request info
reqData?: Object;
reqHeaders?: Object;
// response info
resData?: Object;
resHeaders?: Object;
});
Errors and crashes are automatically caught, and you do not need to do anything. But if you want to send custom error, you can also use the following API.
NOTE: If you override
componentDidCatch
you must also send an error from it yourself.
// send error to debbuger client
AppDebugger.error({
// error object
error: Error;
// short description of the error
message?: string;
// any metadata to help you
meta?: Object;
});
if you use isOverwriteConsole: true
logs will be sent automatically
// send console.log to debbuger client
AppDebugger.log(...args: any[]);
// send console.warn to debbuger client
AppDebugger.logWarn(...args: any[]);
// send console.error to debbuger client
AppDebugger.logError(...args: any[]);
App Debugger client gif example
if you care, you can donate money, thanks 🙃
WMR - R115771767910
WMZ - Z233893567937
WME - E585715598235