对于React Native应用程序,有没有办法查看生产环境中的console.log输出?据我所知这是不可能的。
我知道我可以将重要消息写入文件或远程数据库。我正在寻找一个更简单的解决方案...您是否使用推荐的github包实现了此类功能?
我正在寻找Android的解决方案。
答案 0 :(得分:1)
编写并使用自己的组件<ConsoleLog>
const ConsoleLog = ({ children }) => {
console.log(children)
};
然后使用它:
render() {
return (
<div>
<h1>List of todos</h1>
<ConsoleLog>{ this.props.todos }</ConsoleLog>
</div>
);
}
如果要登录到文件,请使用react-native-file-log软件包