{"id":19537446,"url":"https://github.com/margelo/react-native-app-logs","last_synced_at":"2025-04-26T14:37:36.744Z","repository":{"id":249644076,"uuid":"827753963","full_name":"margelo/react-native-app-logs","owner":"margelo","description":"Access native logs from JS code","archived":false,"fork":false,"pushed_at":"2024-10-30T13:31:51.000Z","size":1621,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-30T13:46:26.847Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/margelo.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2024-07-12T09:53:30.000Z","updated_at":"2024-10-30T13:31:55.000Z","dependencies_parsed_at":"2024-07-22T13:02:01.101Z","dependency_job_id":"cfca3914-b817-47cb-8ea3-8531c9e62b6a","html_url":"https://github.com/margelo/react-native-app-logs","commit_stats":null,"previous_names":["margelo/react-native-app-logs"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-app-logs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-app-logs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-app-logs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-app-logs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/margelo","download_url":"https://codeload.github.com/margelo/react-native-app-logs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224038224,"owners_count":17245387,"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":[],"created_at":"2024-11-11T02:27:58.315Z","updated_at":"2024-11-11T02:27:59.077Z","avatar_url":"https://github.com/margelo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://margelo.com\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./docs/static/img/bg-dark.png\" /\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"./docs/static/img/bg-light.png\" /\u003e\n    \u003cimg alt=\"AppLogs\" src=\"./docs/static/img/bg-light.png\" /\u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\n\n# react-native-app-logs\n\nAccess native logs from JS code\n\n## Installation\n\n```sh\nnpm install react-native-app-logs\n```\n\n## Usage\n\n### Basic usage\n\nThe code snippet below will intercept all logs from the main app.\n\n```js\nimport AppLogs from 'react-native-app-logs';\n\n// ...\n\nAppLogs.configure({ interval: 5 });\n\nAppLogs.registerHandler({\n  filter: '[AppName]',\n  handler: ({ filter, logs }) =\u003e {\n    if (logs.length !== 0) {\n      Alert.alert(filter, logs.join('\\n'));\n    }\n  },\n});\n```\n\n### Intercept logs from `NotificationServiceExtension`\n\nOn iOS each process has its own logs and they live only within the process (and do not share the logs with other processes).\n\nTo intercept logs from `NotificationServiceExtension` you need to:\n\n- give common app group for both `NotificationServiceExtension` and the main app;\n- specify `appGroupName` in `AppLogs.configure` method:\n\n```ts\nimport AppLogs from 'react-native-app-logs';\n\nAppLogs.configure({ appGroupName: 'group.applogs.example', interval: 5 });\n```\n\n- add new Pod to your `NotificationServiceExtension`:\n\n```rb\ntarget 'NotificationService' do\n  pod 'AppLogs', :path =\u003e '../../AppLogsPod/'\nend\n```\n\n- forward logs from `NotificationServiceExtension` to the main app:\n\n```swift\nimport AppLogs\n\nclass NotificationService: UNNotificationServiceExtension {\n    let appLogs: AppLogs = .init()\n\n    deinit {\n        appLogs.forwardLogsTo(appGroup: \"group.applogs.example\")\n    }\n}\n```\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n\n---\n\nMade with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmargelo%2Freact-native-app-logs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmargelo%2Freact-native-app-logs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmargelo%2Freact-native-app-logs/lists"}