{"id":4453,"url":"https://github.com/olofd/react-native-device-log","last_synced_at":"2025-05-09T00:07:22.868Z","repository":{"id":57336509,"uuid":"52746308","full_name":"olofd/react-native-device-log","owner":"olofd","description":"A UI and service for handling/displaying dev log messages on devices","archived":false,"fork":false,"pushed_at":"2020-04-26T12:49:05.000Z","size":53,"stargazers_count":101,"open_issues_count":10,"forks_count":56,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-09T00:07:16.092Z","etag":null,"topics":["error-handling","logging","react-native"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/olofd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-28T21:51:10.000Z","updated_at":"2024-03-05T14:04:32.000Z","dependencies_parsed_at":"2022-09-03T07:20:26.699Z","dependency_job_id":null,"html_url":"https://github.com/olofd/react-native-device-log","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olofd%2Freact-native-device-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olofd%2Freact-native-device-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olofd%2Freact-native-device-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olofd%2Freact-native-device-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olofd","download_url":"https://codeload.github.com/olofd/react-native-device-log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166519,"owners_count":21864482,"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":["error-handling","logging","react-native"],"created_at":"2024-01-05T20:17:13.063Z","updated_at":"2025-05-09T00:07:22.849Z","avatar_url":"https://github.com/olofd.png","language":"JavaScript","readme":"# react-native-device-log\n\n### Description\nA debug-view that prints your debug-messages in a neat listview.\nSupports different levels of log-messages, complex data (With pretty printing), timers for measuring perf and much more.\nAdheres to a simple, async, protocol for saving messages where you can plug in your own adapter, or\nuse AsyncStorage from React Native to persist log-messages between session. (Or just use simple session in-memory storage).\n\nAlso tracks Connectivity of Device and App-State-changes (Background, Idle, Active).\n\nWill also, if you choose to (flag), track exceptions in your app and in React Native and log linenumbers and methods\nso you can track crashes in production.\n\nConfigure how many messages that should be rendered in the ListView and how many messages should be persisted.\nAll built to be efficent and fast.\n\n\u003ca href=\"https://dl.dropboxusercontent.com/u/12645300/Screenshots/react-native-device-log.gif\"\u003e\u003cimg src=\"https://dl.dropboxusercontent.com/u/12645300/Screenshots/react-native-device-log.gif\" width=\"350\"\u003e\u003c/a\u003e\n\n\n# Install:\n```\nnpm install react-native-device-log --save\n```\n# Example:\n```js\n/**\n * Sample React Native App width react-native-device-log\n * https://github.com/facebook/react-native\n */\nimport React, { Component } from 'react';\nimport  {\n  AppRegistry,\n  StyleSheet,\n  Text,\n  View,\n  AsyncStorage\n} from 'react-native';\n\n//The device-log contains the public api that you will use in your app.\n//The LogView is the GUI/Log-list that you can render at desired location //in your app:\n\nimport deviceLog, {LogView, InMemoryAdapter} from 'react-native-device-log';\n\n//Call init and set a custom adapter that implements the interface of\n//AsyncStorage: getItem, removeItem, setItem.\n//By default the log uses a in-memory object, in this example we\n//explicitly set the log to use the persistent AsyncStorage instead:\n\ndeviceLog.init(AsyncStorage /* You can send new InMemoryAdapter() if you do not want to persist here*/\n,{\n  //Options (all optional):\n  logToConsole : false, //Send logs to console as well as device-log\n  logRNErrors : true, // Will pick up RN-errors and send them to the device log\n  maxNumberToRender : 2000, // 0 or undefined == unlimited\n  maxNumberToPersist : 2000 // 0 or undefined == unlimited\n}).then(() =\u003e {\n\n  //When the deviceLog has been initialized we can clear it if we want to:\n  //deviceLog.clear();\n\n});\n\n//The device-log contains a timer for measuring performance:\ndeviceLog.startTimer('start-up');\n\nclass AwesomeProject extends Component {\n\n  componentDidMount() {\n    //Print the current time of the above timer:\n    deviceLog.logTime('start-up');\n\n    //Available log messages:\n    deviceLog.log(\"Hello\", \"world!\");\n    deviceLog.info(\"A info message\");\n    deviceLog.debug(\"A debug message\", {test: \"test\"});\n    deviceLog.success(\"A success message\");\n\n    //Print the current time of the above timer again:\n    deviceLog.logTime('start-up');\n\n    //Later stop and remove the timer:\n    //Will not print anything.\n    deviceLog.stopTimer('start-up');\n\n    setTimeout(() =\u003e {\n      deviceLog.error(\"I'm late!!\");\n    }, 3000);\n  }\n\n  render() {\n    /*\n    inverted: will write the log inverted.\n    multiExpanded: means that multiple logmessages\n    that are longer then one row can be expanded simultaneously\n    timeStampFormat: moment format for timeStamp\n    */\n    return (\n      \u003cLogView inverted={false} multiExpanded={true} timeStampFormat='HH:mm:ss'\u003e\u003c/LogView\u003e\n    );\n  }\n}\n\nAppRegistry.registerComponent('AwesomeProject', () =\u003e AwesomeProject);\n```\n","funding_links":[],"categories":["Components"],"sub_categories":["Utils \u0026 Infra"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folofd%2Freact-native-device-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folofd%2Freact-native-device-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folofd%2Freact-native-device-log/lists"}