I want to write logs to file from RN app. I want to use files for a few reasons:
QA/debugging - I send the app to QA/other developers. In case of an error, I want them to send me the file, so I will understand what is the issue.
On production, I might want to send the log file to the server on specific scenarios (critical bugs).
I don't mind asking for storage permission since I need it anyway (for other features). It's very strange that I didn't find any package for it. I expect to have something like log4j/logback, including rolling file, log levels, etc. Is there any package that can do this?
I want to write logs to file from RN app. I want to use files for a few reasons:
QA/debugging - I send the app to QA/other developers. In case of an error, I want them to send me the file, so I will understand what is the issue.
On production, I might want to send the log file to the server on specific scenarios (critical bugs).
I don't mind asking for storage permission since I need it anyway (for other features). It's very strange that I didn't find any package for it. I expect to have something like log4j/logback, including rolling file, log levels, etc. Is there any package that can do this?
Share Improve this question edited Jun 20, 2021 at 14:25 Harikrishnan 9,99911 gold badges87 silver badges128 bronze badges asked Apr 8, 2019 at 4:31 Shay HazanShay Hazan 3431 gold badge5 silver badges12 bronze badges1 Answer
Reset to default 4react-native-file-log is a good choice. It can log messages to files.
Usage:
import RNReactLogging from 'react-native-file-log';
RNReactLogging.setTag('MyAppName'); // default: RNReactLogging
RNReactLogging.setConsoleLogEnabled(false); // default: true
RNReactLogging.setFileLogEnabled(true); // default: false
RNReactLogging.setMaxFileSize(1024 * 1024); // default: 512 * 1024 ~ 512 kb
RNReactLogging.printLog('test log');
Also check Rollbar which is a realtime crash and error logging solution.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744961884a4603438.html
评论列表(0条)