Giter Site home page Giter Site logo

betomorrow / react-native-file-logger Goto Github PK

View Code? Open in Web Editor NEW
107.0 107.0 23.0 1.24 MB

A simple file-logger for React Native with configurable rolling policy, based on CocoaLumberjack on iOS and Logback on Android.

JavaScript 2.59% Java 29.75% Ruby 7.69% Objective-C 6.86% TypeScript 26.57% Objective-C++ 19.74% Kotlin 6.80%
cocoalumberjack file-logger logback logging react-native

react-native-file-logger's People

Contributors

alois-beto avatar f462 avatar fdrault avatar simontreny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-file-logger's Issues

Unable to add as a dependency to an expo managed project while using expo-dev-client

Hi,

I have an expo-managed project that is using expo SDK 47 where native modules can be added to a project via development build.

I am getting the following error when I run it using the eas build command listed in the expo docs

eas build --profile development --platform ios

Error:

/node
[!] Invalid `Podfile` file: 
[!] Invalid `RNFileLogger.podspec` file: undefined method `install_modules_dependencies' for Pod:Module
Did you mean?  install_flipper_dependencies.
 #  from /Users/expo/workingdir/build/node_modules/react-native-file-logger/RNFileLogger.podspec:21
 #  -------------------------------------------
 #    ## Dependencies needed for new architecture.
 >    install_modules_dependencies(s)
 #  
 #  -------------------------------------------
.
 #  from /Users/expo/workingdir/build/packages/mobile/ios/Podfile:14
 #  -------------------------------------------
 #    use_expo_modules!
 >    config = use_native_modules!
 #  
 #  -------------------------------------------

Is this due to npx pod install being an additional step for this package to work correctly? Wouldn't react native auto linking take care of the dependent pod installations automatically?

Also does this require turbo modules to be enabled? I have it off in my project and looking at the code I am expecting it to fallback to the old NativeModule based FileLogger.

Any help is appreciated. Thanks in advance. πŸ™

React 17 support?

Hello,

It seems react-native-file-logger depends on react@^16.8.1. Is there a chance this can be updated to react@^17.0.0 (or whichever 17 version number makes sense).

Thanks.

Way to get the log file?

In our application we are looking for the log file to be uploaded to our logger service on demand, So, I need to get the log file and send it to the logger service via API call. Let me know if there is any method that I should look into.

Disable a specific log level

Hi,

I notice that in my log file, there are many long warning messasge which really disturbed me. Is it possible to disable a specific log level, like only disable loglevel.warning?

Thanks

Logged file contains garbage text with some strange `PARSER_ERROR` error

I can see that the logs are perfectly fine when printed in the debug console. But for some reason when I check the log file in release mode, it contains such below garbage text throughout the file:

%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR[msg]%PARSER_ERROR[n]%PARSER_ERROR
......

I started facing this issue abruptly, all my dependencies are unchanged. I am using an older version of react-native-file-logger: v0.3.0. I checked v0.4.0 version of this module as well, same issue there. v0.5.4 has some problems with pod install on RN version 0.68.7 that my project is using.

I observed this issue on both platforms: Android and iOS. But seems more prominent on Android.

sendLogFilesByEmail not working on iPhone

Can you support other mail composer to send emails other than native one on iphone? I think it is fine for users to leave app when sending log file since they can come back after that. It really confuses users when they click on 'send logs' button but nothing happens, or at least it should throw an error that the Mail app is not configured or something like that.

Change the log filename

Hello,

I was wondering if it was possible to add an option to change the file name when sending by e-mail. Maybe it's already possible, but I don't seem to have seen it in the documentation?

Thanks in advance! :)
And thank's for the lib, very easy to use πŸ™

Not writing any logs inside the log file

it just creates log file in the cacahe folder, and it does not write anytihing inside it.

import { FileLogger } from "react-native-file-logger";

FileLogger.configure();

sendLogFilesByEmail not working on iPhone

Hello,

Thank you for this great library! I'm having some issues with my personal iPhone 6s. When calling the method sendLogFilesByEmail the Promise never gets resolved. On other devices (Android & iOS) it works perfectly.

I think it's related with the default mailing app (I'm using Gmail). If so, it should throw an error that the Mail app is not configured or something like that.

iOS Doesn’t support multiple recipients.

in Android we are able send email to multiple recipients by passing value in To parameters as '[email protected],[email protected]'
but in iOS it's only allowing to send email to one recipient
So if possibles add support for iOS . So we can send email to multiple recipients

  const sendLogFilesByEmail = () => {
    FileLogger.sendLogFilesByEmail({
      to: '[email protected],[email protected]',
      subject: 'Log files',
      body: 'Please find attached the log files from your app',
    });
  };

Missing option to ommit the log files in mail sharing

Adding such feature to the API should be a piece of cake, and it could be crucial for some people because:

  • they can reuse the module for content-related reports (i.e. wrong text there and there) as well where there is no need to include log files since such kind of mistakes could be just static content, e.g. in a database
  • various policies stress that users have options not to share their data, which is the case here: it is possible to manually delete these files from the mail draft, but it would be much more elegant if developers could let the user decide whether to share their data
  • showing the option 'do not include my data' could possibly make users hesitate less to share errors, although maybe without log files - further sharing could be communicated through individually

Add log file compression feature

Hi,

I love this file logger, it's so easy to use. Helped me a lot.

One great enhancement would be to email compressed log files , either a single file containing all log files or several compressed file. This would enable users to share larger log files which might be too big for email. From what I know - log/text files get compressed to about 10% of their original size.

Regards,

URGENT: Need to upgrade version of Cocoalumberjack to 3.8.5 to include the privacy manifest updates

Apple has started requiring all 3rd party SDKs to declare the usage of APIs listed here in a privacy manifest. As part of this CocoaLumberjack recently added theirs in this commit

This will impact the upstream apps that rely on this lib and risk getting rejected. The deadline for this change is May 1st but we (app developers) need time to make changes on our end after upgrading this lib. Please Help!

Plugin with id 'maven' not found

Build failed when install this repo on latest React Native version (0.67.3), it return two error messages

  • What went wrong:
    A problem occurred evaluating project ':react-native-file-logger'.

Plugin with id 'maven' not found.

  • What went wrong:
    A problem occurred configuring project ':react-native-file-logger'.

Could not find method mavenDeployer() for arguments [build_4ea9nrup07e5ggy3lwew2e09s$_run_closure4$_closure15$_closure17@30919c66] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

For temporary fix, i am just make some changes in build.gradle
About Error 1, update
apply plugin: 'maven'
to
apply plugin: 'maven-publish'

About Error 2, comment installArchives function in build.gradle

Create multiple log files

Is it possible to write to two different log files. Say for example File A and File B. In File A I need to write only particular logs and in File B all my console and other logs.

Any help is appreciated.
Thanks in advance.

Unable to build Android app

Hi,
I am running in to this issue while running the expo/react native generated Android app I have.

> Duplicate class org.slf4j.impl.StaticLoggerBinder found in modules jetified-logback-android-2.0.0-runtime (com.github.tony19:logback-android:2.0.0) and jetified-slf4j-android-1.7.36 (org.slf4j:slf4j-android:1.7.36)
     Duplicate class org.slf4j.impl.StaticMDCBinder found in modules jetified-logback-android-2.0.0-runtime (com.github.tony19:logback-android:2.0.0) and jetified-slf4j-android-1.7.36 (org.slf4j:slf4j-android:1.7.36)
     Duplicate class org.slf4j.impl.StaticMarkerBinder found in modules jetified-logback-android-2.0.0-runtime (com.github.tony19:logback-android:2.0.0) and jetified-slf4j-android-1.7.36 (org.slf4j:slf4j-android:1.7.36)

The recommended version per the logback README file seems to be 1.7.36 since 2.x is not supported in gradle?

Seems like adding android.enableJetifier=true to gradle.properties file could help?

What would be the best way to resolve this? Thanks for your help in advance.

Add ability to zip the logs when rolling date the files

There can be lots of logs file and it may be hard to send it by mail if not zipped.

I know that for Android, this library is using logback which can have a built in RollingFileAppender.
But we should maybe be able ton configure it in javascript side

Expo standalone build fails - MFMailComposeViewController symbol not found

I'm using Expo on react-native version 0.72.3 and it fails creating a standalone build for the device (iOS)... Has anyone encountered this?

This is the output from where it fails after running:
npx expo run:ios --device

❌ Undefined symbols for architecture arm64
β”Œβ”€ Symbol: OBJC_CLASS$_MFMailComposeViewController
└─ Referenced from: objc-class-ref in RNFileLogger(FileLogger.o)

❌ ld: symbol(s) not found for architecture arm64

❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-debug' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'fmt' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RCT-Folly' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-utils' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-runtimescheduler' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'ReactCommon' from project 'Pods')
no rule to process file '/Users/willryan/Development/RapidTapping/rapid-tapping-expo-app/node_modules/react-native-agora-chat/native_src/objc/README.md' of type 'net.daringfireball.markdown' for architecture 'arm64' (in target 'react-native-chat-sdk' from project 'Pods')
Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-Codegen' from project 'Pods')
Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXConstants' from project 'Pods')
Run script build phase '[CP-User] Generate app.manifest for expo-updates' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXUpdates' from project 'Pods')
Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RapidTapping' from project 'RapidTapping')
Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RapidTapping' from project 'RapidTapping')
Run script build phase '[CP-User] [RNFB] Core Configuration' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RapidTapping' from project 'RapidTapping')
β€Ί 3 error(s), and 14 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

Fallback strategy for log file sharing

Hello, firstly, thanks for this awesome library!
I am having problems with two physical iOS devices - both use GMail instead of native apple mail system and sharing logs ends with

Possible Unhandled Promise Rejection (id: 2):
Error: Cannot send emails on this device

Is it possible to fix this behavior somehow? Even if it was not possible (easily), I would like a hint on what to do in such cases - the promise fails and I would like to tell the user how to share the files in a different way. I would like to avoid direct XHR post, security-wise the email sharing approach is brilliant...

Thanks

[Android] Specify a namespace

React Native 0.73 will depend on Android Gradle Plugin (AGP) 8.x. This will require all the libraries to specify a namespace in their build.gradle file. We added a compatibility layer for libraries that haven't specified a namespace, but please consider updating your libraries nonetheless.

To follow last recommandation, we need to specify a namespace for our library. It will breaks compatibility with RN<71, so I might wait a bit before comply to this.

Note: react-native-community/discussions-and-proposals#671

format date and time

how can i change format of date and time using this library
i can see that "formatter" prop but any sample example on how to use it

FileLogger.sendLogFilesByEmail not working on iOS

React native 0.72.1
iOS 16
Call FileLogger.sendLogFilesByEmail but nothing show up
Got below err from console

Bridge call to: deviceContexts
[Presentation] Attempt to present <MFMailComposeViewController: 0x15cdc4c00> on <RCTModalHostViewController: 0x146910dc0> (from <RCTModalHostViewController: 0x146910dc0>) whose view is not in the window hierarchy.
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:17345 (
0 AXRuntime 0x00000001b8ad9468 _AXGetPortFromCache + 904
1 AXRuntime 0x00000001b8adb5d4 AXUIElementPerformFencedActionWithValue + 768
2 UIKit 0x000000020ee3bd74 630A7729-DCCE-311E-B6BF-226BFFD35685 + 736628
3 libdispatch.dylib 0x00000001053a8028 _dispatch_call_block_and_release + 24
4 libdispatch.dylib 0x00000001053a9860 _dispatch_client_callout + 16
5 libdispatch.dylib 0x00000001053b09bc _dispatch_lane_serial_drain + 688
6 libdispatch.dylib 0x00000001053b1634 _dispatch_lane_invoke + 424
7 libdispatch.dylib 0x00000001053bd158 _dispatch_workloop_worker_thread + 696
8 libsystem_pthread.dylib 0x00000001d97acb50 _pthread_wqthread + 284
9 libsystem_pthread.dylib 0x00000001d97ac67c start_wqthread + 8
)
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:17345 (
0 AXRuntime 0x00000001b8ad9468 _AXGetPortFromCache + 904
1 AXRuntime 0x00000001b8adb5d4 AXUIElementPerformFencedActionWithValue + 768
2 UIKit 0x000000020ee3bd74 630A7729-DCCE-311E-B6BF-226BFFD35685 + 736628
3 libdispatch.dylib 0x00000001053a8028 _dispatch_call_block_and_release + 24
4 libdispatch.dylib 0x00000001053a9860 _dispatch_client_callout + 16
5 libdispatch.dylib 0x00000001053b09bc _dispatch_lane_serial_drain + 688
6 libdispatch.dylib 0x00000001053b1634 _dispatch_lane_invoke + 424
7 libdispatch.dylib 0x00000001053bd158 _dispatch_workloop_worker_thread + 696
8 libsystem_pthread.dylib 0x00000001d97acb50 _pthread_wqthread + 284
9 libsystem_pthread.dylib 0x00000001d97ac67c start_wqthread + 8
)

Question about the `root.detachAndStopAllAppenders()` call

Hi,

First, thank you for this project, I started using it a few days ago and it makes way easier to get debug data from the app's testers

I'm investigating an incompatibility between react-native-file-logger and react-native-background-geolocation which has its own log mechanism, also based on logback-android

When using both libraries, then the geolocation library stops working

I just found that this is because react-native-file-logger calls root.detachAndStopAllAppenders() during its initialization. Due to this, the react-native-background-geolocation's appenders are cleared and so it cannot do its job anymore

I tried to remove this line locally and it fixes the problem

The question is now: why is this line needed?

The project's history says that it has been added in this specific commit: 5c04853

Because it was not initially there and because it has been added later, my conclusion is that it is here for a specific purpose (i.e. to fix a bug) and so I don't want to remove it without understanding why it was here in the first place

So my two question are:

  • Do you remember why it was needed?
  • Based on first answer, do you think I should remove this in a local patch? or to make a PR on this repo?

Thanks

Wrong timestamp in the logs.

I am writing logs at around 2:17 pm. My computer and my Android phone are both at the same time.

However, when I write logs, I see the time in the logs as follows:

2022-04-04T18:17:51.856Z [INFO]

Can someone help me to understand which time is this? It may be taking a time from different timezone. Anyone know the fix for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.