Installations
npm install react-native-network-logger
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
20.12.2
NPM Version
10.5.0
Score
60.4
Supply Chain
60.4
Quality
70.3
Maintenance
50
Vulnerability
93.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (97.65%)
JavaScript (2.35%)
Developer
alexbrazier
Download Statistics
Total Downloads
2,597,852
Last Day
1,020
Last Week
25,031
Last Month
111,346
Last Year
1,125,268
GitHub Statistics
560 Stars
138 Commits
49 Forks
10 Watching
3 Branches
7 Contributors
Package Meta Information
Latest Version
1.17.0
Package Id
react-native-network-logger@1.17.0
Unpacked Size
386.34 kB
Size
77.33 kB
File Count
225
NPM Version
10.5.0
Node Version
20.12.2
Publised On
24 Sept 2024
Total Downloads
Cumulative downloads
Total Downloads
2,597,852
Last day
2%
1,020
Compared to previous day
Last week
-14%
25,031
Compared to previous week
Last month
-19.1%
111,346
Compared to previous month
Last year
52.3%
1,125,268
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
2
react-native-network-logger
An HTTP traffic monitor for React Native including in app interface.
An alternative to Wormholy but for both iOS and Android and with zero native dependencies.
If this project has helped you out, please support us with a star 🌟.
Features
- Log networks requests on iOS and Android
- View network requests made with in app viewer
- Debug network requests on release builds
- Individually view request/response headers and body
- Copy or share headers, body or full request
- Share cURL representation of request
- Zero native or JavaScript dependencies
- Built in TypeScript definitions
- Extracts GraphQL operation name
- Export all logs in HAR format
Screenshots
iOS
Android
Setup
Install
1yarn add react-native-network-logger
or
npm install --save react-native-network-logger
Start Logging
Call startNetworkLogging
in your apps entry point to log every request, or call it on a button press to manually trigger it.
1import { startNetworkLogging } from 'react-native-network-logger'; 2 3startNetworkLogging(); 4AppRegistry.registerComponent('App', () => App);
Display Requests and Responses
1import NetworkLogger from 'react-native-network-logger'; 2 3const MyScreen = () => <NetworkLogger />;
Themes
You can change between the dark and light theme by passing the theme
prop with "dark"
or "light"
.
1import NetworkLogger from 'react-native-network-logger'; 2 3const MyScreen = () => <NetworkLogger theme="dark" />;
If preferred you can also override the theme entirely by passing in a theme object.
Note: breaking theme changes are not guaranteed to follow semver for updates
1import NetworkLogger from 'react-native-network-logger'; 2 3const MyScreen = () => ( 4 <NetworkLogger 5 theme={{ 6 colors: { 7 background: 'red', 8 }, 9 }} 10 /> 11);
Logging options
Max Requests
You can configure the max number of requests stored on the device using by calling startNetworkLogging
with the maxRequests
option. The default is 500
.
1startNetworkLogging({ maxRequests: 500 });
Ignored Hosts
You can configure hosts that should be ignored by calling startNetworkLogging
with the ignoredHosts
option.
1startNetworkLogging({ ignoredHosts: ['test.example.com'] });
Ignored Urls
You can configure urls that should be ignored by calling startNetworkLogging
with the ignoredUrls
option.
1startNetworkLogging({ ignoredUrls: ['https://test.example.com/page'] });
Ignored Patterns
You can configure url patterns, including methods that should be ignored by calling startNetworkLogging
with the ignoredPatterns
option.
1startNetworkLogging({
2 ignoredPatterns: [/^GET http:\/\/test\.example\.com\/pages\/.*$/],
3});
The pattern to match with is the method followed by the url, e.g. GET http://example.com/test
so you can use the pattern to match anything, e.g. ignoring all HEAD requests.
1startNetworkLogging({ 2 // Ignore all HEAD requests 3 ignoredPatterns: [/^HEAD /], 4});
Sorting
Set the sort order of requests. Options are asc
or desc
, default is desc
(most recent at the top).
1import NetworkLogger from 'react-native-network-logger'; 2 3const MyScreen = () => <NetworkLogger sort="asc" />;
Max Rows
Set the maximum number of rows to display in the list to improve rendering. Default is same as request limit.
1import NetworkLogger from 'react-native-network-logger'; 2 3const MyScreen = () => <NetworkLogger maxRows={100} />;
Compact Rows
Make the rows smaller to fit more on the screen.
1import NetworkLogger from 'react-native-network-logger'; 2 3const MyScreen = () => <NetworkLogger compact />;
Force Enable
If you are running another network logging interceptor, e.g. Reactotron, the logger will not start as only one can be run at once. You can override this behaviour and force the logger to start by using the forceEnable
option.
1startNetworkLogging({ forceEnable: true });
Integrate with existing navigation
Use your existing back button (e.g. in your navigation header) to navigate within the network logger.
1import NetworkLogger, { getBackHandler } from 'react-native-network-logger'; 2 3const navigation = useNavigation(); 4const onBack = getBackHandler(navigation.goBack); 5 6const MyScreen = () => ( 7 <Screen onBackPressed={onBack}> 8 <NetworkLogger /> 9 </Screen> 10);
Example App
To test the example app, after cloning the repo, install the required dependencies by running:
1yarn bootstrap
Then start the example app by running:
1yarn example start
You should then be able to open the expo server at http://localhost:3000/ and launch the app on iOS or Android.
For more setup and development details, see Contributing.
Why
Network requests can be debugged using tools such as React Native Debugger, however this requires both a debug build of the app and the debugger to be enabled. This library can be built with you app and usable by anyone using your app to see network issues and report them back to developers.
As the library is very small you can safely bundle it with the production version of your app and put it behind a flag, or have a separate testing build of the app which has the network logger enabled.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 16 commits out of 23 are checked with a SAST tool
Reason
5 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 9/27 approved changesets -- score normalized to 3
Reason
8 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:17
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:18
- Warn: no topLevel permission defined: .github/workflows/actions.yml:1
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/actions.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/alexbrazier/react-native-network-logger/actions.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/actions.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/alexbrazier/react-native-network-logger/actions.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/actions.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/alexbrazier/react-native-network-logger/actions.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/actions.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/alexbrazier/react-native-network-logger/actions.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/alexbrazier/react-native-network-logger/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/alexbrazier/react-native-network-logger/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/alexbrazier/react-native-network-logger/codeql-analysis.yml/master?enable=pin
- Info: 0 out of 7 GitHub-owned GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
4.3
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-native-network-logger
react-native-netwatch
Network traffic logger for React Native
react-native-requests-logger
Log all network requests made in react native apps into chrome dev tools network tab.
rn-vconsole-panel
A Logger that runs on the device is the same as the chrome console or vconsole. rn-vconsole-panel can log the Console, Network, Router Stack, Storage, System Info automatic.
react-native-ws-logger
An out-of-the-box websocket network viewer