{"id":4465,"url":"https://github.com/alexbrazier/react-native-network-logger","last_synced_at":"2025-04-07T23:10:42.864Z","repository":{"id":40333531,"uuid":"273360051","full_name":"alexbrazier/react-native-network-logger","owner":"alexbrazier","description":"An HTTP network request monitor for React Native with in-app interface for iOS and Android with no native code","archived":false,"fork":false,"pushed_at":"2024-04-13T15:35:39.000Z","size":7857,"stargazers_count":482,"open_issues_count":11,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-26T03:32:11.792Z","etag":null,"topics":["android","charles","debugger","hacktoberfest","ios","logging","network","network-debug","network-monitoring","react-native"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexbrazier.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-18T23:27:45.000Z","updated_at":"2024-06-18T15:32:07.876Z","dependencies_parsed_at":"2023-12-20T21:22:48.361Z","dependency_job_id":"5c138606-6f4c-48e8-a69f-8ba47ab7a1df","html_url":"https://github.com/alexbrazier/react-native-network-logger","commit_stats":{"total_commits":109,"total_committers":4,"mean_commits":27.25,"dds":0.05504587155963303,"last_synced_commit":"e96b15602251b579416ce6ac5028bf127a53b39d"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexbrazier%2Freact-native-network-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexbrazier%2Freact-native-network-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexbrazier%2Freact-native-network-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexbrazier%2Freact-native-network-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexbrazier","download_url":"https://codeload.github.com/alexbrazier/react-native-network-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744335,"owners_count":20988783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","charles","debugger","hacktoberfest","ios","logging","network","network-debug","network-monitoring","react-native"],"created_at":"2024-01-05T20:17:13.419Z","updated_at":"2025-04-07T23:10:42.807Z","avatar_url":"https://github.com/alexbrazier.png","language":"TypeScript","funding_links":[],"categories":["Components"],"sub_categories":["Utils \u0026 Infra"],"readme":"# react-native-network-logger [![GitHub stars](https://img.shields.io/github/stars/alexbrazier/react-native-network-logger?label=Star%20Project\u0026style=social)](https://github.com/alexbrazier/react-native-network-logger/stargazers)\n\n[![CI](https://github.com/alexbrazier/react-native-network-logger/workflows/CI/badge.svg)](https://github.com/alexbrazier/react-native-network-logger/actions)\n[![Dependencies](https://img.shields.io/badge/dependencies-none-green)](https://www.npmjs.com/package/react-native-network-logger?activeTab=dependencies)\n[![npm](https://img.shields.io/npm/v/react-native-network-logger)](https://www.npmjs.com/package/react-native-network-logger)\n[![npm bundle size](https://img.shields.io/bundlephobia/min/react-native-network-logger)](https://bundlephobia.com/result?p=react-native-network-logger)\n[![npm downloads](https://img.shields.io/npm/dm/react-native-network-logger)](https://www.npmjs.com/package/react-native-network-logger)\n[![License](https://img.shields.io/npm/l/react-native-network-logger)](./LICENSE)\n\nAn HTTP traffic monitor for React Native including in app interface.\n\nAn alternative to Wormholy but for both iOS and Android and with zero native dependencies.\n\nIf this project has helped you out, please support us with a star 🌟.\n\n## Features\n\n- Log networks requests on iOS and Android\n- View network requests made with in app viewer\n- Debug network requests on release builds\n- Individually view request/response headers and body\n- Copy or share headers, body or full request\n- Share cURL representation of request\n- Zero native or JavaScript dependencies\n- Built in TypeScript definitions\n- Extracts GraphQL operation name\n- Export all logs in HAR format\n\n## Screenshots\n\n### iOS\n\n\u003cp float=\"left\" align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/ios-list.png\" width=\"300\" /\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/ios-details.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\u003cp float=\"left\" align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/ios-list-dark.png\" width=\"300\" /\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/ios-details-dark.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\n### Android\n\n\u003cp float=\"left\" align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/android-list.png\" width=\"300\" /\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/android-details.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\u003cp float=\"left\" align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/android-list-dark.png\" width=\"300\" /\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/alexbrazier/react-native-network-logger/master/.github/images/android-details-dark.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\n## Setup\n\n### Install\n\n```bash\nyarn add react-native-network-logger\n```\n\nor\n\n```\nnpm install --save react-native-network-logger\n```\n\n### Start Logging\n\nCall `startNetworkLogging` in your apps entry point to log every request, or call it on a button press to manually trigger it.\n\n```ts\nimport { startNetworkLogging } from 'react-native-network-logger';\n\nstartNetworkLogging();\nAppRegistry.registerComponent('App', () =\u003e App);\n```\n\n### Display Requests and Responses\n\n```ts\nimport NetworkLogger from 'react-native-network-logger';\n\nconst MyScreen = () =\u003e \u003cNetworkLogger /\u003e;\n```\n\n#### Themes\n\nYou can change between the dark and light theme by passing the `theme` prop with `\"dark\"` or `\"light\"`.\n\n```ts\nimport NetworkLogger from 'react-native-network-logger';\n\nconst MyScreen = () =\u003e \u003cNetworkLogger theme=\"dark\" /\u003e;\n```\n\nIf preferred you can also override the theme entirely by passing in a theme object.\n\n\u003e Note: breaking theme changes are not guaranteed to follow semver for updates\n\n```ts\nimport NetworkLogger from 'react-native-network-logger';\n\nconst MyScreen = () =\u003e (\n  \u003cNetworkLogger\n    theme={{\n      colors: {\n        background: 'red',\n      },\n    }}\n  /\u003e\n);\n```\n\n### Logging options\n\n#### Max Requests\n\nYou can configure the max number of requests stored on the device using by calling `startNetworkLogging` with the `maxRequests` option. The default is `500`.\n\n```ts\nstartNetworkLogging({ maxRequests: 500 });\n```\n\n#### Ignored Hosts\n\nYou can configure hosts that should be ignored by calling `startNetworkLogging` with the `ignoredHosts` option.\n\n```ts\nstartNetworkLogging({ ignoredHosts: ['test.example.com'] });\n```\n\n#### Ignored Urls\n\nYou can configure urls that should be ignored by calling `startNetworkLogging` with the `ignoredUrls` option.\n\n```ts\nstartNetworkLogging({ ignoredUrls: ['https://test.example.com/page'] });\n```\n\n#### Ignored Patterns\n\nYou can configure url patterns, including methods that should be ignored by calling `startNetworkLogging` with the `ignoredPatterns` option.\n\n```ts\nstartNetworkLogging({\n  ignoredPatterns: [/^GET http:\\/\\/test\\.example\\.com\\/pages\\/.*$/],\n});\n```\n\nThe 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.\n\n```ts\nstartNetworkLogging({\n  // Ignore all HEAD requests\n  ignoredPatterns: [/^HEAD /],\n});\n```\n\n#### Sorting\n\nSet the sort order of requests. Options are `asc` or `desc`, default is `desc` (most recent at the top).\n\n```tsx\nimport NetworkLogger from 'react-native-network-logger';\n\nconst MyScreen = () =\u003e \u003cNetworkLogger sort=\"asc\" /\u003e;\n```\n\n#### Max Rows\n\nSet the maximum number of rows to display in the list to improve rendering. Default is same as request limit.\n\n```tsx\nimport NetworkLogger from 'react-native-network-logger';\n\nconst MyScreen = () =\u003e \u003cNetworkLogger maxRows={100} /\u003e;\n```\n\n#### Compact Rows\n\nMake the rows smaller to fit more on the screen.\n\n```tsx\nimport NetworkLogger from 'react-native-network-logger';\n\nconst MyScreen = () =\u003e \u003cNetworkLogger compact /\u003e;\n```\n\n#### Force Enable\n\nIf 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.\n\n```ts\nstartNetworkLogging({ forceEnable: true });\n```\n\n#### Integrate with existing navigation\n\nUse your existing back button (e.g. in your navigation header) to navigate within the network logger.\n\n```tsx\nimport NetworkLogger, { getBackHandler } from 'react-native-network-logger';\n\nconst navigation = useNavigation();\nconst onBack = getBackHandler(navigation.goBack);\n\nconst MyScreen = () =\u003e (\n  \u003cScreen onBackPressed={onBack}\u003e\n    \u003cNetworkLogger /\u003e\n  \u003c/Screen\u003e\n);\n```\n\n## Example App\n\nTo test the example app, after cloning the repo, install the required dependencies by running:\n\n```sh\nyarn bootstrap\n```\n\nThen start the example app by running:\n\n```sh\nyarn example start\n```\n\nYou should then be able to open the expo server at http://localhost:3000/ and launch the app on iOS or Android.\n\nFor more setup and development details, see [Contributing](#Contributing).\n\n## Why\n\nNetwork 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.\n\nAs 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.\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexbrazier%2Freact-native-network-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexbrazier%2Freact-native-network-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexbrazier%2Freact-native-network-logger/lists"}