javascript - How to use file logger in react-native app - Stack Overflow

I want to write logs to file from RN app.I want to use files for a few reasons:QAdebugging - I send t

I want to write logs to file from RN app. I want to use files for a few reasons:

  1. 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.

  2. 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:

  1. 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.

  2. 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 badges
Add a ment  | 

1 Answer 1

Reset to default 4

react-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

相关推荐

  • javascript - How to use file logger in react-native app - Stack Overflow

    I want to write logs to file from RN app.I want to use files for a few reasons:QAdebugging - I send t

    1天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信