Ver código fonte

rn: add native loggers

These provide the ability to integrate the SDK with some other application
loggers.

At the time this was written we use Timber on Android and CocoaLumberjack on iOS.

In addition to the integration capabilities, a LogBridge React Native module
provides log transports for JavaScript code, thus centralizing all logs on the
native loggers.
master
Saúl Ibarra Corretgé 5 anos atrás
pai
commit
902da8cc4f
41 arquivos alterados com 932 adições e 190 exclusões
  1. 1
    0
      android/sdk/build.gradle
  2. 2
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/AmplitudeModule.java
  3. 17
    20
      android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java
  4. 6
    9
      android/sdk/src/main/java/org/jitsi/meet/sdk/BluetoothHeadsetMonitor.java
  5. 20
    30
      android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java
  6. 4
    4
      android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java
  7. 5
    4
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java
  8. 8
    7
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java
  9. 2
    2
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetUncaughtExceptionHandler.java
  10. 3
    8
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
  11. 73
    0
      android/sdk/src/main/java/org/jitsi/meet/sdk/LogBridgeModule.java
  12. 4
    3
      android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java
  13. 3
    2
      android/sdk/src/main/java/org/jitsi/meet/sdk/PictureInPictureModule.java
  14. 8
    7
      android/sdk/src/main/java/org/jitsi/meet/sdk/RNConnectionService.java
  15. 2
    0
      android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java
  16. 4
    6
      android/sdk/src/main/java/org/jitsi/meet/sdk/WiFiStatsModule.java
  17. 49
    0
      android/sdk/src/main/java/org/jitsi/meet/sdk/log/JitsiMeetBaseLogHandler.java
  18. 39
    0
      android/sdk/src/main/java/org/jitsi/meet/sdk/log/JitsiMeetDefaultLogHandler.java
  19. 94
    0
      android/sdk/src/main/java/org/jitsi/meet/sdk/log/JitsiMeetLogger.java
  20. 4
    4
      android/sdk/src/main/java/org/jitsi/meet/sdk/net/NAT64AddrInfoModule.java
  21. 1
    0
      ios/Podfile
  22. 8
    2
      ios/Podfile.lock
  23. 32
    4
      ios/sdk/sdk.xcodeproj/project.pbxproj
  24. 5
    3
      ios/sdk/src/AudioMode.m
  25. 2
    0
      ios/sdk/src/JitsiMeet.h
  26. 24
    0
      ios/sdk/src/JitsiMeetBaseLogHandler+Private.h
  27. 28
    0
      ios/sdk/src/JitsiMeetBaseLogHandler.h
  28. 105
    0
      ios/sdk/src/JitsiMeetBaseLogHandler.m
  29. 27
    0
      ios/sdk/src/JitsiMeetLogger.h
  30. 40
    0
      ios/sdk/src/JitsiMeetLogger.m
  31. 57
    0
      ios/sdk/src/LogBridge.m
  32. 23
    0
      ios/sdk/src/LogUtils.h
  33. 4
    2
      ios/sdk/src/analytics/AmplitudeModule.m
  34. 22
    54
      ios/sdk/src/callkit/CallKit.m
  35. 111
    11
      package-lock.json
  36. 1
    0
      package.json
  37. 65
    0
      react/features/base/logging/LogTransport.native.js
  38. 0
    0
      react/features/base/logging/LogTransport.web.js
  39. 23
    1
      react/features/base/logging/functions.js
  40. 0
    6
      react/features/base/logging/middleware.js
  41. 6
    0
      react/index.native.js

+ 1
- 0
android/sdk/build.gradle Ver arquivo

@@ -44,6 +44,7 @@ dependencies {
44 44
     implementation 'org.webkit:android-jsc:+'
45 45
 
46 46
     implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
47
+    implementation 'com.jakewharton.timber:timber:4.7.1'
47 48
 
48 49
     if (!rootProject.ext.libreBuild) {
49 50
         implementation 'com.amplitude:android-sdk:2.14.1'

+ 2
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/AmplitudeModule.java Ver arquivo

@@ -24,6 +24,7 @@ import com.facebook.react.bridge.ReadableMap;
24 24
 import com.amplitude.api.Amplitude;
25 25
 import com.facebook.react.module.annotations.ReactModule;
26 26
 
27
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
27 28
 import org.json.JSONException;
28 29
 import org.json.JSONObject;
29 30
 
@@ -90,7 +91,7 @@ class AmplitudeModule
90 91
             JSONObject eventProps = new JSONObject(eventPropsString);
91 92
             Amplitude.getInstance(instanceName).logEvent(eventType, eventProps);
92 93
         } catch (JSONException e) {
93
-            e.printStackTrace();
94
+            JitsiMeetLogger.e(e, "Error logging event");
94 95
         }
95 96
     }
96 97
 

+ 17
- 20
android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java Ver arquivo

@@ -25,7 +25,6 @@ import android.content.pm.PackageManager;
25 25
 import android.media.AudioDeviceInfo;
26 26
 import android.media.AudioManager;
27 27
 import android.os.Build;
28
-import android.util.Log;
29 28
 import androidx.annotation.RequiresApi;
30 29
 
31 30
 import com.facebook.react.bridge.Arguments;
@@ -37,6 +36,8 @@ import com.facebook.react.bridge.WritableArray;
37 36
 import com.facebook.react.bridge.WritableMap;
38 37
 import com.facebook.react.module.annotations.ReactModule;
39 38
 
39
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
40
+
40 41
 import java.util.HashMap;
41 42
 import java.util.HashSet;
42 43
 import java.util.Map;
@@ -121,7 +122,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
121 122
             case DEVICE_SPEAKER:
122 123
                 return android.telecom.CallAudioState.ROUTE_SPEAKER;
123 124
             default:
124
-                Log.e(TAG, "Unsupported device name: " + audioDevice);
125
+                JitsiMeetLogger.e(TAG + " Unsupported device name: " + audioDevice);
125 126
                 return android.telecom.CallAudioState.ROUTE_EARPIECE;
126 127
         }
127 128
     }
@@ -218,7 +219,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
218 219
             }
219 220
 
220 221
             availableDevices = devices;
221
-            Log.d(TAG, "Available audio devices: " +
222
+            JitsiMeetLogger.i(TAG + " Available audio devices: " +
222 223
                 availableDevices.toString());
223 224
 
224 225
             // Reset user selection
@@ -360,7 +361,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
360 361
                     data.pushMap(deviceInfo);
361 362
                 }
362 363
                 ReactInstanceManagerHolder.emitEvent(DEVICE_CHANGE_EVENT, data);
363
-                Log.i(TAG, "Updating audio device list");
364
+                JitsiMeetLogger.i(TAG + " Updating audio device list");
364 365
             }
365 366
         });
366 367
     }
@@ -443,8 +444,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
443 444
                 if (audioDevicesChanged) {
444 445
                     supportedRouteMask = newSupportedRoutes;
445 446
                     availableDevices = routesToDeviceNames(supportedRouteMask);
446
-                    Log.d(TAG,
447
-                          "Available audio devices: "
447
+                    JitsiMeetLogger.i(TAG + " Available audio devices: "
448 448
                                   + availableDevices.toString());
449 449
                 }
450 450
 
@@ -478,7 +478,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
478 478
     public void onAudioFocusChange(int focusChange) {
479 479
         switch (focusChange) {
480 480
         case AudioManager.AUDIOFOCUS_GAIN: {
481
-            Log.d(TAG, "Audio focus gained");
481
+            JitsiMeetLogger.d(TAG + " Audio focus gained");
482 482
             // Some other application potentially stole our audio focus
483 483
             // temporarily. Restore our mode.
484 484
             if (audioFocusLost) {
@@ -490,7 +490,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
490 490
         case AudioManager.AUDIOFOCUS_LOSS:
491 491
         case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
492 492
         case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: {
493
-            Log.d(TAG, "Audio focus lost");
493
+            JitsiMeetLogger.d(TAG + " Audio focus lost");
494 494
             audioFocusLost = true;
495 495
             break;
496 496
         }
@@ -517,13 +517,13 @@ class AudioModeModule extends ReactContextBaseJavaModule
517 517
             @Override
518 518
             public void run() {
519 519
                 if (!availableDevices.contains(device)) {
520
-                    Log.d(TAG, "Audio device not available: " + device);
520
+                    JitsiMeetLogger.w(TAG + " Audio device not available: " + device);
521 521
                     userSelectedDevice = null;
522 522
                     return;
523 523
                 }
524 524
 
525 525
                 if (mode != -1) {
526
-                    Log.d(TAG, "User selected device set to: " + device);
526
+                    JitsiMeetLogger.i(TAG + " User selected device set to: " + device);
527 527
                     userSelectedDevice = device;
528 528
                     updateAudioRoute(mode);
529 529
                 }
@@ -594,10 +594,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
594 594
                     success = updateAudioRoute(mode);
595 595
                 } catch (Throwable e) {
596 596
                     success = false;
597
-                    Log.e(
598
-                            TAG,
599
-                            "Failed to update audio route for mode: " + mode,
600
-                            e);
597
+                    JitsiMeetLogger.e(e, TAG + " Failed to update audio route for mode: " + mode);
601 598
                 }
602 599
                 if (success) {
603 600
                     AudioModeModule.this.mode = mode;
@@ -633,14 +630,14 @@ class AudioModeModule extends ReactContextBaseJavaModule
633 630
                     @Override
634 631
                     public void onAudioDevicesAdded(
635 632
                             AudioDeviceInfo[] addedDevices) {
636
-                        Log.d(TAG, "Audio devices added");
633
+                        JitsiMeetLogger.d(TAG + " Audio devices added");
637 634
                         onAudioDeviceChange();
638 635
                     }
639 636
 
640 637
                     @Override
641 638
                     public void onAudioDevicesRemoved(
642 639
                             AudioDeviceInfo[] removedDevices) {
643
-                        Log.d(TAG, "Audio devices removed");
640
+                        JitsiMeetLogger.d(TAG + " Audio devices removed");
644 641
                         onAudioDeviceChange();
645 642
                     }
646 643
                 };
@@ -659,7 +656,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
659 656
         BroadcastReceiver wiredHeadsetReceiver = new BroadcastReceiver() {
660 657
             @Override
661 658
             public void onReceive(Context context, Intent intent) {
662
-                Log.d(TAG, "Wired headset added / removed");
659
+                JitsiMeetLogger.d(TAG + " Wired headset added / removed");
663 660
                 onHeadsetDeviceChange();
664 661
             }
665 662
         };
@@ -677,7 +674,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
677 674
      * {@code false}, otherwise.
678 675
      */
679 676
     private boolean updateAudioRoute(int mode) {
680
-        Log.d(TAG, "Update audio route for mode: " + mode);
677
+        JitsiMeetLogger.i(TAG + " Update audio route for mode: " + mode);
681 678
 
682 679
         if (mode == DEFAULT) {
683 680
             if (!useConnectionService()) {
@@ -703,7 +700,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
703 700
                     AudioManager.STREAM_VOICE_CALL,
704 701
                     AudioManager.AUDIOFOCUS_GAIN)
705 702
                     == AudioManager.AUDIOFOCUS_REQUEST_FAILED) {
706
-                Log.d(TAG, "Audio focus request failed");
703
+                JitsiMeetLogger.w(TAG + " Audio focus request failed");
707 704
                 return false;
708 705
             }
709 706
         }
@@ -734,7 +731,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
734 731
         }
735 732
 
736 733
         selectedDevice = audioDevice;
737
-        Log.d(TAG, "Selected audio device: " + audioDevice);
734
+        JitsiMeetLogger.i(TAG + " Selected audio device: " + audioDevice);
738 735
 
739 736
         if (useConnectionService()) {
740 737
             setAudioRoute(audioDevice);

+ 6
- 9
android/sdk/src/main/java/org/jitsi/meet/sdk/BluetoothHeadsetMonitor.java Ver arquivo

@@ -24,7 +24,8 @@ import android.content.Context;
24 24
 import android.content.Intent;
25 25
 import android.content.IntentFilter;
26 26
 import android.media.AudioManager;
27
-import android.util.Log;
27
+
28
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
28 29
 
29 30
 /**
30 31
  * Helper class to detect and handle Bluetooth device changes.  It monitors
@@ -77,7 +78,7 @@ class BluetoothHeadsetMonitor {
77 78
             = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
78 79
 
79 80
         if (!audioManager.isBluetoothScoAvailableOffCall()) {
80
-            Log.w(AudioModeModule.TAG, "Bluetooth SCO is not available");
81
+            JitsiMeetLogger.w(AudioModeModule.TAG + " Bluetooth SCO is not available");
81 82
             return;
82 83
         }
83 84
 
@@ -93,7 +94,7 @@ class BluetoothHeadsetMonitor {
93 94
         BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
94 95
 
95 96
         if (adapter == null) {
96
-            Log.w(AudioModeModule.TAG, "Device doesn't support Bluetooth");
97
+            JitsiMeetLogger.w(AudioModeModule.TAG + " Device doesn't support Bluetooth");
97 98
             return false;
98 99
         }
99 100
 
@@ -148,9 +149,7 @@ class BluetoothHeadsetMonitor {
148 149
             switch (state) {
149 150
             case BluetoothHeadset.STATE_CONNECTED:
150 151
             case BluetoothHeadset.STATE_DISCONNECTED:
151
-                Log.d(
152
-                        AudioModeModule.TAG,
153
-                        "BT headset connection state changed: " + state);
152
+                JitsiMeetLogger.d(AudioModeModule.TAG + " BT headset connection state changed: " + state);
154 153
                 updateDevices();
155 154
                 break;
156 155
             }
@@ -164,9 +163,7 @@ class BluetoothHeadsetMonitor {
164 163
             switch (state) {
165 164
             case AudioManager.SCO_AUDIO_STATE_CONNECTED:
166 165
             case AudioManager.SCO_AUDIO_STATE_DISCONNECTED:
167
-                Log.d(
168
-                        AudioModeModule.TAG,
169
-                        "BT SCO connection state changed: " + state);
166
+                JitsiMeetLogger.d(AudioModeModule.TAG + " BT SCO connection state changed: " + state);
170 167
                 updateDevices();
171 168
                 break;
172 169
             }

+ 20
- 30
android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java Ver arquivo

@@ -13,13 +13,14 @@ import android.telecom.PhoneAccount;
13 13
 import android.telecom.PhoneAccountHandle;
14 14
 import android.telecom.TelecomManager;
15 15
 import android.telecom.VideoProfile;
16
-import android.util.Log;
17 16
 import androidx.annotation.RequiresApi;
18 17
 
19 18
 import com.facebook.react.bridge.Promise;
20 19
 import com.facebook.react.bridge.ReadableMap;
21 20
 import com.facebook.react.bridge.WritableNativeMap;
22 21
 
22
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
23
+
23 24
 import java.util.ArrayList;
24 25
 import java.util.HashMap;
25 26
 import java.util.List;
@@ -129,9 +130,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
129 130
         if (connection != null) {
130 131
             connection.setActive();
131 132
         } else {
132
-            Log.e(TAG, String.format(
133
-                    "setConnectionActive - no connection for UUID: %s",
134
-                    callUUID));
133
+            JitsiMeetLogger.e("% setConnectionActive - no connection for UUID: %s", TAG, callUUID);
135 134
         }
136 135
     }
137 136
 
@@ -162,7 +161,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
162 161
             connection.setDisconnected(cause);
163 162
             connection.destroy();
164 163
         } else {
165
-            Log.e(TAG, "endCall no connection for UUID: " + callUUID);
164
+            JitsiMeetLogger.e(TAG + " endCall no connection for UUID: " + callUUID);
166 165
         }
167 166
     }
168 167
 
@@ -194,15 +193,14 @@ public class ConnectionService extends android.telecom.ConnectionService {
194 193
                 boolean hasVideo
195 194
                         = callState.getBoolean(ConnectionImpl.KEY_HAS_VIDEO);
196 195
 
197
-                Log.d(TAG, String.format(
198
-                        "updateCall: %s hasVideo: %s", callUUID, hasVideo));
196
+                JitsiMeetLogger.i(" %s updateCall: %s hasVideo: %s", TAG, callUUID, hasVideo);
199 197
                 connection.setVideoState(
200 198
                         hasVideo
201 199
                                 ? VideoProfile.STATE_BIDIRECTIONAL
202 200
                                 : VideoProfile.STATE_AUDIO_ONLY);
203 201
             }
204 202
         } else {
205
-            Log.e(TAG, "updateCall no connection for UUID: " + callUUID);
203
+            JitsiMeetLogger.e(TAG +     " updateCall no connection for UUID: " + callUUID);
206 204
         }
207 205
     }
208 206
 
@@ -238,13 +236,11 @@ public class ConnectionService extends android.telecom.ConnectionService {
238 236
             = unregisterStartCallPromise(connection.getCallUUID());
239 237
 
240 238
         if (startCallPromise != null) {
241
-            Log.d(TAG,
242
-                  "onCreateOutgoingConnection " + connection.getCallUUID());
239
+            JitsiMeetLogger.d(TAG + " onCreateOutgoingConnection " + connection.getCallUUID());
243 240
             startCallPromise.resolve(null);
244 241
         } else {
245
-            Log.e(TAG, String.format(
246
-                "onCreateOutgoingConnection: no start call Promise for %s",
247
-                connection.getCallUUID()));
242
+            JitsiMeetLogger.e(
243
+                TAG + " onCreateOutgoingConnection: no start call Promise for " + connection.getCallUUID());
248 244
         }
249 245
 
250 246
         return connection;
@@ -268,7 +264,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
268 264
         PhoneAccountHandle theAccountHandle = request.getAccountHandle();
269 265
         String callUUID = theAccountHandle.getId();
270 266
 
271
-        Log.e(TAG, "onCreateOutgoingConnectionFailed " + callUUID);
267
+        JitsiMeetLogger.e(TAG + " onCreateOutgoingConnectionFailed " + callUUID);
272 268
 
273 269
         if (callUUID != null) {
274 270
             Promise startCallPromise = unregisterStartCallPromise(callUUID);
@@ -278,12 +274,10 @@ public class ConnectionService extends android.telecom.ConnectionService {
278 274
                         "CREATE_OUTGOING_CALL_FAILED",
279 275
                         "The request has been denied by the system");
280 276
             } else {
281
-                Log.e(TAG, String.format(
282
-                        "startCallFailed - no start call Promise for UUID: %s",
283
-                        callUUID));
277
+                JitsiMeetLogger.e(TAG + " startCallFailed - no start call Promise for UUID: " + callUUID);
284 278
             }
285 279
         } else {
286
-            Log.e(TAG, "onCreateOutgoingConnectionFailed - no call UUID");
280
+            JitsiMeetLogger.e(TAG + " onCreateOutgoingConnectionFailed - no call UUID");
287 281
         }
288 282
 
289 283
         unregisterPhoneAccount(theAccountHandle);
@@ -295,10 +289,10 @@ public class ConnectionService extends android.telecom.ConnectionService {
295 289
             if (phoneAccountHandle != null) {
296 290
                 telecom.unregisterPhoneAccount(phoneAccountHandle);
297 291
             } else {
298
-                Log.e(TAG, "unregisterPhoneAccount - account handle is null");
292
+                JitsiMeetLogger.e(TAG + " unregisterPhoneAccount - account handle is null");
299 293
             }
300 294
         } else {
301
-            Log.e(TAG, "unregisterPhoneAccount - telecom is null");
295
+            JitsiMeetLogger.e(TAG + "unregisterPhoneAccount - telecom is null");
302 296
         }
303 297
     }
304 298
 
@@ -357,7 +351,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
357 351
          */
358 352
         @Override
359 353
         public void onDisconnect() {
360
-            Log.d(TAG, "onDisconnect " + getCallUUID());
354
+            JitsiMeetLogger.i(TAG + " onDisconnect " + getCallUUID());
361 355
             WritableNativeMap data = new WritableNativeMap();
362 356
             data.putString("callUUID", getCallUUID());
363 357
             ReactInstanceManagerHolder.emitEvent(
@@ -377,7 +371,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
377 371
          */
378 372
         @Override
379 373
         public void onAbort() {
380
-            Log.d(TAG, "onAbort " + getCallUUID());
374
+            JitsiMeetLogger.i(TAG + " onAbort " + getCallUUID());
381 375
             WritableNativeMap data = new WritableNativeMap();
382 376
             data.putString("callUUID", getCallUUID());
383 377
             ReactInstanceManagerHolder.emitEvent(
@@ -395,9 +389,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
395 389
             // What ?! Android will still call this method even if we do not add
396 390
             // the HOLD capability, so do the same thing as on abort.
397 391
             // TODO implement HOLD
398
-            Log.d(TAG, String.format(
399
-                  "onHold %s - HOLD is not supported, aborting the call...",
400
-                  getCallUUID()));
392
+            JitsiMeetLogger.w(TAG + " onHold %s - HOLD is not supported, aborting the call...", getCallUUID());
401 393
             this.onAbort();
402 394
         }
403 395
 
@@ -410,7 +402,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
410 402
          */
411 403
         @Override
412 404
         public void onCallAudioStateChanged(CallAudioState state) {
413
-            Log.d(TAG, "onCallAudioStateChanged: " + state);
405
+            JitsiMeetLogger.d(TAG + " onCallAudioStateChanged: " + state);
414 406
             AudioModeModule audioModeModule
415 407
                     = ReactInstanceManagerHolder
416 408
                     .getNativeModule(AudioModeModule.class);
@@ -426,10 +418,8 @@ public class ConnectionService extends android.telecom.ConnectionService {
426 418
          */
427 419
         @Override
428 420
         public void onStateChanged(int state) {
429
-            Log.d(TAG,
430
-                  String.format("onStateChanged: %s %s",
431
-                                Connection.stateToString(state),
432
-                                getCallUUID()));
421
+            JitsiMeetLogger.d(
422
+                "%s onStateChanged: %s %s", TAG, Connection.stateToString(state), getCallUUID());
433 423
 
434 424
             if (state == STATE_DISCONNECTED) {
435 425
                 removeConnection(this);

+ 4
- 4
android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java Ver arquivo

@@ -16,14 +16,14 @@
16 16
 
17 17
 package org.jitsi.meet.sdk;
18 18
 
19
-import android.util.Log;
20
-
21 19
 import com.facebook.react.bridge.ReactApplicationContext;
22 20
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
23 21
 import com.facebook.react.bridge.ReactMethod;
24 22
 import com.facebook.react.bridge.ReadableMap;
25 23
 import com.facebook.react.module.annotations.ReactModule;
26 24
 
25
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
26
+
27 27
 /**
28 28
  * Module implementing an API for sending events from JavaScript to native code.
29 29
  */
@@ -76,11 +76,11 @@ class ExternalAPIModule
76 76
         BaseReactView view = BaseReactView.findViewByExternalAPIScope(scope);
77 77
 
78 78
         if (view != null) {
79
-            Log.d(TAG, "Sending event: " + name + " with data: " + data);
79
+            JitsiMeetLogger.d(TAG + " Sending event: " + name + " with data: " + data);
80 80
             try {
81 81
                 view.onExternalAPIEvent(name, data);
82 82
             } catch(Exception e) {
83
-                Log.e(TAG, "onExternalAPIEvent: error sending event", e);
83
+                JitsiMeetLogger.e(e, TAG + " onExternalAPIEvent: error sending event");
84 84
             }
85 85
         }
86 86
     }

+ 5
- 4
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java Ver arquivo

@@ -20,12 +20,13 @@ import android.content.Context;
20 20
 import android.content.Intent;
21 21
 import android.net.Uri;
22 22
 import android.os.Bundle;
23
-import android.util.Log;
24 23
 import androidx.annotation.Nullable;
25 24
 import androidx.fragment.app.FragmentActivity;
26 25
 
27 26
 import com.facebook.react.modules.core.PermissionListener;
28 27
 
28
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
29
+
29 30
 import java.util.Map;
30 31
 
31 32
 
@@ -208,19 +209,19 @@ public class JitsiMeetActivity extends FragmentActivity
208 209
 
209 210
     @Override
210 211
     public void onConferenceJoined(Map<String, Object> data) {
211
-        Log.d(TAG, "Conference joined: " + data);
212
+        JitsiMeetLogger.i("Conference joined: " + data);
212 213
         // Launch the service for the ongoing notification.
213 214
         JitsiMeetOngoingConferenceService.launch(this);
214 215
     }
215 216
 
216 217
     @Override
217 218
     public void onConferenceTerminated(Map<String, Object> data) {
218
-        Log.d(TAG, "Conference terminated: " + data);
219
+        JitsiMeetLogger.i("Conference terminated: " + data);
219 220
         finish();
220 221
     }
221 222
 
222 223
     @Override
223 224
     public void onConferenceWillJoin(Map<String, Object> data) {
224
-        Log.d(TAG, "Conference will join: " + data);
225
+        JitsiMeetLogger.i("Conference will join: " + data);
225 226
     }
226 227
 }

+ 8
- 7
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java Ver arquivo

@@ -23,7 +23,8 @@ import android.content.Context;
23 23
 import android.content.Intent;
24 24
 import android.os.Build;
25 25
 import android.os.IBinder;
26
-import android.util.Log;
26
+
27
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
27 28
 
28 29
 
29 30
 /**
@@ -55,7 +56,7 @@ public class JitsiMeetOngoingConferenceService extends Service
55 56
             componentName = context.startService(intent);
56 57
         }
57 58
         if (componentName == null) {
58
-            Log.w(TAG, "Ongoing conference service not started");
59
+            JitsiMeetLogger.w(TAG + " Ongoing conference service not started");
59 60
         }
60 61
     }
61 62
 
@@ -90,20 +91,20 @@ public class JitsiMeetOngoingConferenceService extends Service
90 91
             Notification notification = OngoingNotification.buildOngoingConferenceNotification();
91 92
             if (notification == null) {
92 93
                 stopSelf();
93
-                Log.w(TAG, "Couldn't start service, notification is null");
94
+                JitsiMeetLogger.w(TAG + " Couldn't start service, notification is null");
94 95
             } else {
95 96
                 startForeground(OngoingNotification.NOTIFICATION_ID, notification);
96
-                Log.i(TAG, "Service started");
97
+                JitsiMeetLogger.i(TAG + " Service started");
97 98
             }
98 99
         } else if (action.equals(Actions.HANGUP)) {
99
-            Log.i(TAG, "Hangup requested");
100
+            JitsiMeetLogger.i(TAG + " Hangup requested");
100 101
             // Abort all ongoing calls
101 102
             if (AudioModeModule.useConnectionService()) {
102 103
                 ConnectionService.abortConnections();
103 104
             }
104 105
             stopSelf();
105 106
         } else {
106
-            Log.w(TAG, "Unknown action received: " + action);
107
+            JitsiMeetLogger.w(TAG + " Unknown action received: " + action);
107 108
             stopSelf();
108 109
         }
109 110
 
@@ -114,7 +115,7 @@ public class JitsiMeetOngoingConferenceService extends Service
114 115
     public void onCurrentConferenceChanged(String conferenceUrl) {
115 116
         if (conferenceUrl == null) {
116 117
             stopSelf();
117
-            Log.i(TAG, "Service stopped");
118
+            JitsiMeetLogger.i(TAG + "Service stopped");
118 119
         }
119 120
     }
120 121
 }

+ 2
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetUncaughtExceptionHandler.java Ver arquivo

@@ -17,7 +17,7 @@
17 17
 
18 18
 package org.jitsi.meet.sdk;
19 19
 
20
-import android.util.Log;
20
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
21 21
 
22 22
 class JitsiMeetUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
23 23
     private final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler;
@@ -37,7 +37,7 @@ class JitsiMeetUncaughtExceptionHandler implements Thread.UncaughtExceptionHandl
37 37
 
38 38
     @Override
39 39
     public void uncaughtException(Thread t, Throwable e) {
40
-        Log.e(this.getClass().getSimpleName(), "FATAL ERROR", e);
40
+        JitsiMeetLogger.e(e, this.getClass().getSimpleName() + " FATAL ERROR");
41 41
 
42 42
         // Abort all ConnectionService ongoing calls
43 43
         if (AudioModeModule.useConnectionService()) {

+ 3
- 8
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java Ver arquivo

@@ -19,12 +19,13 @@ package org.jitsi.meet.sdk;
19 19
 
20 20
 import android.content.Context;
21 21
 import android.os.Bundle;
22
-import android.util.Log;
23 22
 import androidx.annotation.NonNull;
24 23
 import androidx.annotation.Nullable;
25 24
 
26 25
 import com.facebook.react.bridge.ReadableMap;
27 26
 
27
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
28
+
28 29
 import java.lang.reflect.Method;
29 30
 import java.util.Map;
30 31
 
@@ -39,12 +40,6 @@ public class JitsiMeetView extends BaseReactView<JitsiMeetViewListener>
39 40
     private static final Map<String, Method> LISTENER_METHODS
40 41
         = ListenerUtils.mapListenerMethods(JitsiMeetViewListener.class);
41 42
 
42
-    /**
43
-     * The {@link Log} tag which identifies the source of the log messages of
44
-     * {@code JitsiMeetView}.
45
-     */
46
-    private static final String TAG = JitsiMeetView.class.getSimpleName();
47
-
48 43
     /**
49 44
      * The URL of the current conference.
50 45
      */
@@ -137,7 +132,7 @@ public class JitsiMeetView extends BaseReactView<JitsiMeetViewListener>
137 132
             try {
138 133
                 pipModule.enterPictureInPicture();
139 134
             } catch (RuntimeException re) {
140
-                Log.e(TAG, "failed to enter PiP mode", re);
135
+                JitsiMeetLogger.e(re, "Failed to enter PiP mode");
141 136
             }
142 137
         }
143 138
     }

+ 73
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/LogBridgeModule.java Ver arquivo

@@ -0,0 +1,73 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package org.jitsi.meet.sdk;
18
+
19
+import com.facebook.react.bridge.ReactApplicationContext;
20
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
21
+import com.facebook.react.bridge.ReactMethod;
22
+import com.facebook.react.module.annotations.ReactModule;
23
+
24
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
25
+
26
+import javax.annotation.Nonnull;
27
+
28
+/**
29
+ * Module implementing a "bridge" between the JS loggers and the native one.
30
+ */
31
+@ReactModule(name = LogBridgeModule.NAME)
32
+class LogBridgeModule extends ReactContextBaseJavaModule {
33
+    public static final String NAME = "LogBridge";
34
+
35
+    public LogBridgeModule(@Nonnull ReactApplicationContext reactContext) {
36
+        super(reactContext);
37
+    }
38
+
39
+    @Override
40
+    public String getName() {
41
+        return NAME;
42
+    }
43
+
44
+    @ReactMethod
45
+    public void trace(final String message) {
46
+        JitsiMeetLogger.v(message);
47
+    }
48
+
49
+    @ReactMethod
50
+    public void debug(final String message) {
51
+        JitsiMeetLogger.d(message);
52
+    }
53
+
54
+    @ReactMethod
55
+    public void info(final String message) {
56
+        JitsiMeetLogger.i(message);
57
+    }
58
+
59
+    @ReactMethod
60
+    public void log(final String message) {
61
+        JitsiMeetLogger.i(message);
62
+    }
63
+
64
+    @ReactMethod
65
+    public void warn(final String message) {
66
+        JitsiMeetLogger.w(message);
67
+    }
68
+
69
+    @ReactMethod
70
+    public void error(final String message) {
71
+        JitsiMeetLogger.e(message);
72
+    }
73
+}

+ 4
- 3
android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java Ver arquivo

@@ -24,7 +24,8 @@ import android.content.Context;
24 24
 import android.content.Intent;
25 25
 import android.os.Build;
26 26
 import androidx.core.app.NotificationCompat;
27
-import android.util.Log;
27
+
28
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
28 29
 
29 30
 import java.util.Random;
30 31
 
@@ -50,7 +51,7 @@ class OngoingNotification {
50 51
 
51 52
         Context context = ReactInstanceManagerHolder.getCurrentActivity();
52 53
         if (context == null) {
53
-            Log.w(TAG, "Cannot create notification channel: no current context");
54
+            JitsiMeetLogger.w(TAG + " Cannot create notification channel: no current context");
54 55
             return;
55 56
         }
56 57
 
@@ -75,7 +76,7 @@ class OngoingNotification {
75 76
     static Notification buildOngoingConferenceNotification() {
76 77
         Context context = ReactInstanceManagerHolder.getCurrentActivity();
77 78
         if (context == null) {
78
-            Log.w(TAG, "Cannot create notification: no current context");
79
+            JitsiMeetLogger.w(TAG + " Cannot create notification: no current context");
79 80
             return null;
80 81
         }
81 82
 

+ 3
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/PictureInPictureModule.java Ver arquivo

@@ -20,7 +20,6 @@ import android.annotation.TargetApi;
20 20
 import android.app.Activity;
21 21
 import android.app.PictureInPictureParams;
22 22
 import android.os.Build;
23
-import android.util.Log;
24 23
 import android.util.Rational;
25 24
 
26 25
 import com.facebook.react.bridge.Promise;
@@ -29,6 +28,8 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
29 28
 import com.facebook.react.bridge.ReactMethod;
30 29
 import com.facebook.react.module.annotations.ReactModule;
31 30
 
31
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
32
+
32 33
 @ReactModule(name = PictureInPictureModule.NAME)
33 34
 class PictureInPictureModule
34 35
     extends ReactContextBaseJavaModule {
@@ -70,7 +71,7 @@ class PictureInPictureModule
70 71
             throw new IllegalStateException("No current Activity!");
71 72
         }
72 73
 
73
-        Log.d(TAG, "Entering Picture-in-Picture");
74
+        JitsiMeetLogger.i(TAG + " Entering Picture-in-Picture");
74 75
 
75 76
         PictureInPictureParams.Builder builder
76 77
             = new PictureInPictureParams.Builder()

+ 8
- 7
android/sdk/src/main/java/org/jitsi/meet/sdk/RNConnectionService.java Ver arquivo

@@ -10,7 +10,6 @@ import android.telecom.PhoneAccount;
10 10
 import android.telecom.PhoneAccountHandle;
11 11
 import android.telecom.TelecomManager;
12 12
 import android.telecom.VideoProfile;
13
-import android.util.Log;
14 13
 import androidx.annotation.RequiresApi;
15 14
 
16 15
 import com.facebook.react.bridge.Promise;
@@ -20,6 +19,8 @@ import com.facebook.react.bridge.ReactMethod;
20 19
 import com.facebook.react.bridge.ReadableMap;
21 20
 import com.facebook.react.module.annotations.ReactModule;
22 21
 
22
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
23
+
23 24
 /**
24 25
  * The react-native side of Jitsi Meet's {@link ConnectionService}. Exposes
25 26
  * the Java Script API.
@@ -74,11 +75,11 @@ class RNConnectionService
74 75
             String handle,
75 76
             boolean hasVideo,
76 77
             Promise promise) {
77
-        Log.d(TAG,
78
-              String.format("startCall UUID=%s, h=%s, v=%s",
78
+        JitsiMeetLogger.d("%d startCall UUID=%s, h=%s, v=%s",
79
+                            TAG,
79 80
                             callUUID,
80 81
                             handle,
81
-                            hasVideo));
82
+                            hasVideo);
82 83
 
83 84
         ReactApplicationContext ctx = getReactApplicationContext();
84 85
 
@@ -118,7 +119,7 @@ class RNConnectionService
118 119
      */
119 120
     @ReactMethod
120 121
     public void reportCallFailed(String callUUID) {
121
-        Log.d(TAG, "reportCallFailed " + callUUID);
122
+        JitsiMeetLogger.d(TAG + " reportCallFailed " + callUUID);
122 123
         ConnectionService.setConnectionDisconnected(
123 124
                 callUUID,
124 125
                 new DisconnectCause(DisconnectCause.ERROR));
@@ -131,7 +132,7 @@ class RNConnectionService
131 132
      */
132 133
     @ReactMethod
133 134
     public void endCall(String callUUID) {
134
-        Log.d(TAG, "endCall " + callUUID);
135
+        JitsiMeetLogger.d(TAG + " endCall " + callUUID);
135 136
         ConnectionService.setConnectionDisconnected(
136 137
                 callUUID,
137 138
                 new DisconnectCause(DisconnectCause.LOCAL));
@@ -144,7 +145,7 @@ class RNConnectionService
144 145
      */
145 146
     @ReactMethod
146 147
     public void reportConnectedOutgoingCall(String callUUID) {
147
-        Log.d(TAG, "reportConnectedOutgoingCall " + callUUID);
148
+        JitsiMeetLogger.d(TAG + " reportConnectedOutgoingCall " + callUUID);
148 149
         ConnectionService.setConnectionActive(callUUID);
149 150
     }
150 151
 

+ 2
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java Ver arquivo

@@ -34,6 +34,7 @@ import com.facebook.soloader.SoLoader;
34 34
 import com.oney.WebRTCModule.RTCVideoViewManager;
35 35
 import com.oney.WebRTCModule.WebRTCModule;
36 36
 
37
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
37 38
 import org.webrtc.SoftwareVideoDecoderFactory;
38 39
 import org.webrtc.SoftwareVideoEncoderFactory;
39 40
 import org.webrtc.VideoDecoderFactory;
@@ -67,6 +68,7 @@ class ReactInstanceManagerHolder {
67 68
                 new DropboxModule(reactContext),
68 69
                 new ExternalAPIModule(reactContext),
69 70
                 new LocaleDetector(reactContext),
71
+                new LogBridgeModule(reactContext),
70 72
                 new PictureInPictureModule(reactContext),
71 73
                 new ProximityModule(reactContext),
72 74
                 new WiFiStatsModule(reactContext),

+ 4
- 6
android/sdk/src/main/java/org/jitsi/meet/sdk/WiFiStatsModule.java Ver arquivo

@@ -19,7 +19,6 @@ package org.jitsi.meet.sdk;
19 19
 import android.content.Context;
20 20
 import android.net.wifi.WifiInfo;
21 21
 import android.net.wifi.WifiManager;
22
-import android.util.Log;
23 22
 
24 23
 import com.facebook.react.bridge.Promise;
25 24
 import com.facebook.react.bridge.ReactApplicationContext;
@@ -27,6 +26,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
27 26
 import com.facebook.react.bridge.ReactMethod;
28 27
 import com.facebook.react.module.annotations.ReactModule;
29 28
 
29
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
30 30
 import org.json.JSONArray;
31 31
 import org.json.JSONObject;
32 32
 
@@ -184,17 +184,15 @@ class WiFiStatsModule
184 184
 
185 185
                         }
186 186
                     } catch (SocketException e) {
187
-                        Log.wtf(TAG,
188
-                            "Unable to NetworkInterface.getNetworkInterfaces()"
189
-                        );
187
+                        JitsiMeetLogger.e(e, TAG + " Unable to NetworkInterface.getNetworkInterfaces()");
190 188
                     }
191 189
 
192 190
                     result.put("addresses", addresses);
193 191
                     promise.resolve(result.toString());
194 192
 
195
-                    Log.d(TAG, "WiFi stats: " + result.toString());
193
+                    JitsiMeetLogger.d(TAG + " WiFi stats: " + result.toString());
196 194
                 } catch (Throwable e) {
197
-                    Log.e(TAG, "Failed to obtain wifi stats", e);
195
+                    JitsiMeetLogger.e(e, TAG + " Failed to obtain wifi stats");
198 196
                     promise.reject(
199 197
                         new Exception("Failed to obtain wifi stats"));
200 198
                 }

+ 49
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/log/JitsiMeetBaseLogHandler.java Ver arquivo

@@ -0,0 +1,49 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package org.jitsi.meet.sdk.log;
18
+
19
+import android.util.Log;
20
+
21
+import org.jetbrains.annotations.NotNull;
22
+import org.jetbrains.annotations.Nullable;
23
+
24
+import java.text.MessageFormat;
25
+
26
+import timber.log.Timber;
27
+
28
+/**
29
+ * Base class for all custom log handlers. Implementations must inherit from this class and
30
+ * implement a `doLog` method which does the actual logging, in addition with a `getTag` method
31
+ * with which to tag all logs coming into this logger.
32
+ *
33
+ * See {@link JitsiMeetDefaultLogHandler} for an example.
34
+ */
35
+public abstract class JitsiMeetBaseLogHandler extends Timber.Tree {
36
+    @Override
37
+    protected void log(int priority, @Nullable String tag, @NotNull String msg, @Nullable Throwable t) {
38
+        String errmsg = Log.getStackTraceString(t);
39
+        if (errmsg.isEmpty()) {
40
+            doLog(priority, getTag(), msg);
41
+        } else {
42
+            doLog(priority, getTag(), MessageFormat.format("{0}\n{1}", msg, errmsg));
43
+        }
44
+    }
45
+
46
+    protected abstract void doLog(int priority, @NotNull String tag, @NotNull String msg);
47
+
48
+    protected abstract String getTag();
49
+}

+ 39
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/log/JitsiMeetDefaultLogHandler.java Ver arquivo

@@ -0,0 +1,39 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package org.jitsi.meet.sdk.log;
18
+
19
+import android.util.Log;
20
+
21
+import org.jetbrains.annotations.NotNull;
22
+
23
+/**
24
+ * Default implementation of a {@link JitsiMeetBaseLogHandler}. This is the main SDK logger, which
25
+ * logs using the Android util.Log module.
26
+ */
27
+public class JitsiMeetDefaultLogHandler extends JitsiMeetBaseLogHandler {
28
+    private static final String TAG = "JitsiMeetSDK";
29
+
30
+    @Override
31
+    protected void doLog(int priority, @NotNull String tag, @NotNull String msg) {
32
+        Log.println(priority, tag, msg);
33
+    }
34
+
35
+    @Override
36
+    protected String getTag() {
37
+        return TAG;
38
+    }
39
+}

+ 94
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/log/JitsiMeetLogger.java Ver arquivo

@@ -0,0 +1,94 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package org.jitsi.meet.sdk.log;
18
+
19
+import timber.log.Timber;
20
+
21
+public class JitsiMeetLogger {
22
+    static {
23
+        addHandler(new JitsiMeetDefaultLogHandler());
24
+    }
25
+
26
+    public static void addHandler(JitsiMeetBaseLogHandler handler) {
27
+        Timber.plant(handler);
28
+    }
29
+
30
+    public static void removeHandler(JitsiMeetBaseLogHandler handler) {
31
+        Timber.uproot(handler);
32
+    }
33
+
34
+    public static void v(String message, Object... args) {
35
+        Timber.v(message, args);
36
+    }
37
+
38
+    public static void v(Throwable t, String message, Object... args) {
39
+        Timber.v(t, message, args);
40
+    }
41
+
42
+    public static void v(Throwable t) {
43
+        Timber.v(t);
44
+    }
45
+
46
+    public static void d(String message, Object... args) {
47
+        Timber.d(message, args);
48
+    }
49
+
50
+    public static void d(Throwable t, String message, Object... args) {
51
+        Timber.d(t, message, args);
52
+    }
53
+
54
+    public static void d(Throwable t) {
55
+        Timber.d(t);
56
+    }
57
+
58
+    public static void i(String message, Object... args) {
59
+        Timber.i(message, args);
60
+    }
61
+
62
+    public static void i(Throwable t, String message, Object... args) {
63
+        Timber.i(t, message, args);
64
+    }
65
+
66
+    public static void i(Throwable t) {
67
+        Timber.i(t);
68
+    }
69
+
70
+    public static void w(String message, Object... args) {
71
+        Timber.w(message, args);
72
+    }
73
+
74
+    public static void w(Throwable t, String message, Object... args) {
75
+        Timber.w(t, message, args);
76
+    }
77
+
78
+    public static void w(Throwable t) {
79
+        Timber.w(t);
80
+    }
81
+
82
+    public static void e(String message, Object... args) {
83
+        Timber.e(message, args);
84
+    }
85
+
86
+    public static void e(Throwable t, String message, Object... args) {
87
+        Timber.e(t, message, args);
88
+    }
89
+
90
+    public static void e(Throwable t) {
91
+        Timber.e(t);
92
+    }
93
+
94
+}

+ 4
- 4
android/sdk/src/main/java/org/jitsi/meet/sdk/net/NAT64AddrInfoModule.java Ver arquivo

@@ -15,14 +15,14 @@
15 15
  */
16 16
 package org.jitsi.meet.sdk.net;
17 17
 
18
-import android.util.Log;
19
-
20 18
 import com.facebook.react.bridge.Promise;
21 19
 import com.facebook.react.bridge.ReactApplicationContext;
22 20
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
23 21
 import com.facebook.react.bridge.ReactMethod;
24 22
 import com.facebook.react.module.annotations.ReactModule;
25 23
 
24
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
25
+
26 26
 import java.net.UnknownHostException;
27 27
 
28 28
 /**
@@ -97,7 +97,7 @@ public class NAT64AddrInfoModule
97 97
             try {
98 98
                 info = NAT64AddrInfo.discover(host);
99 99
             } catch (UnknownHostException e) {
100
-                Log.e(TAG, "NAT64AddrInfo.discover: " + host, e);
100
+                JitsiMeetLogger.e(e, TAG + " NAT64AddrInfo.discover: " + host);
101 101
             }
102 102
             infoTimestamp = System.currentTimeMillis();
103 103
         }
@@ -107,7 +107,7 @@ public class NAT64AddrInfoModule
107 107
         try {
108 108
             result = info == null ? null : info.getIPv6Address(ipv4Address);
109 109
         } catch (IllegalArgumentException exc) {
110
-            Log.e(TAG, "Failed to get IPv6 address for: " + ipv4Address, exc);
110
+            JitsiMeetLogger.e(exc, TAG + " Failed to get IPv6 address for: " + ipv4Address);
111 111
 
112 112
             // We don't want to reject. It's not a big deal if there's no IPv6
113 113
             // address resolved.

+ 1
- 0
ios/Podfile Ver arquivo

@@ -61,6 +61,7 @@ target 'JitsiMeet' do
61 61
   #
62 62
 
63 63
   pod 'Amplitude-iOS', '~> 4.0.4'
64
+  pod 'CocoaLumberjack', '~>3.5.3'
64 65
   pod 'ObjectiveDropboxOfficial', '~> 3.9.4'
65 66
 
66 67
   use_native_modules!

+ 8
- 2
ios/Podfile.lock Ver arquivo

@@ -3,6 +3,9 @@ PODS:
3 3
   - boost-for-react-native (1.63.0)
4 4
   - BVLinearGradient (2.5.6):
5 5
     - React
6
+  - CocoaLumberjack (3.5.3):
7
+    - CocoaLumberjack/Core (= 3.5.3)
8
+  - CocoaLumberjack/Core (3.5.3)
6 9
   - Crashlytics (3.12.0):
7 10
     - Fabric (~> 1.9.0)
8 11
   - DoubleConversion (1.1.6)
@@ -187,6 +190,7 @@ PODS:
187 190
 DEPENDENCIES:
188 191
   - Amplitude-iOS (~> 4.0.4)
189 192
   - BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
193
+  - CocoaLumberjack (~> 3.5.3)
190 194
   - Crashlytics (~> 3.12.0)
191 195
   - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
192 196
   - Fabric (~> 1.9.0)
@@ -205,7 +209,7 @@ DEPENDENCIES:
205 209
   - react-native-background-timer (from `../node_modules/react-native-background-timer`)
206 210
   - react-native-calendar-events (from `../node_modules/react-native-calendar-events`)
207 211
   - react-native-keep-awake (from `../node_modules/react-native-keep-awake`)
208
-  - react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)
212
+  - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
209 213
   - react-native-webrtc (from `../node_modules/react-native-webrtc`)
210 214
   - react-native-webview (from `../node_modules/react-native-webview`)
211 215
   - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
@@ -229,6 +233,7 @@ SPEC REPOS:
229 233
   https://github.com/cocoapods/specs.git:
230 234
     - Amplitude-iOS
231 235
     - boost-for-react-native
236
+    - CocoaLumberjack
232 237
     - Crashlytics
233 238
     - Fabric
234 239
     - Firebase
@@ -317,6 +322,7 @@ SPEC CHECKSUMS:
317 322
   Amplitude-iOS: 2ad4d7270c99186236c1272a3a9425463b1ae1a7
318 323
   boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
319 324
   BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
325
+  CocoaLumberjack: 2f44e60eb91c176d471fdba43b9e3eae6a721947
320 326
   Crashlytics: 07fb167b1694128c1c9a5a5cc319b0e9c3ca0933
321 327
   DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
322 328
   Fabric: f988e33c97f08930a413e08123064d2e5f68d655
@@ -365,6 +371,6 @@ SPEC CHECKSUMS:
365 371
   RNWatch: 09738b339eceb66e4d80a2371633ca5fb380fa42
366 372
   yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411
367 373
 
368
-PODFILE CHECKSUM: 0907bfe60b5b5f11dbdc6b4e65d40a248d000513
374
+PODFILE CHECKSUM: 0e3406a4217cc348dcadad5b016e8d939d4aa61f
369 375
 
370 376
 COCOAPODS: 1.7.2

+ 32
- 4
ios/sdk/sdk.xcodeproj/project.pbxproj Ver arquivo

@@ -26,8 +26,6 @@
26 26
 		0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */; };
27 27
 		0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; };
28 28
 		0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */; };
29
-		C30F88D0CB0F4F5593216D24 /* liveStreamingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */; };
30
-		C30F88D2CB0F4F5593216D24 /* liveStreamingOn.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */; };
31 29
 		6C31EDC820C06D490089C899 /* recordingOn.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC720C06D490089C899 /* recordingOn.mp3 */; };
32 30
 		6C31EDCA20C06D530089C899 /* recordingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 6C31EDC920C06D530089C899 /* recordingOff.mp3 */; };
33 31
 		75635B0A20751D6D00F29C9F /* joined.wav in Resources */ = {isa = PBXBuildFile; fileRef = 75635B0820751D6D00F29C9F /* joined.wav */; };
@@ -36,6 +34,8 @@
36 34
 		A4414AE020B37F1A003546E6 /* rejected.wav in Resources */ = {isa = PBXBuildFile; fileRef = A4414ADF20B37F1A003546E6 /* rejected.wav */; };
37 35
 		A480429C21EE335600289B73 /* AmplitudeModule.m in Sources */ = {isa = PBXBuildFile; fileRef = A480429B21EE335600289B73 /* AmplitudeModule.m */; };
38 36
 		A4A934E9212F3ADB001E9388 /* Dropbox.m in Sources */ = {isa = PBXBuildFile; fileRef = A4A934E8212F3ADB001E9388 /* Dropbox.m */; };
37
+		C30F88D0CB0F4F5593216D24 /* liveStreamingOff.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */; };
38
+		C30F88D2CB0F4F5593216D24 /* liveStreamingOn.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */; };
39 39
 		C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; };
40 40
 		C6245F5E2053091D0040BE68 /* image-resize@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5C2053091D0040BE68 /* image-resize@3x.png */; };
41 41
 		C69EFA0C209A0F660027712B /* JMCallKitEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA09209A0F650027712B /* JMCallKitEmitter.swift */; };
@@ -43,8 +43,15 @@
43 43
 		C69EFA0E209A0F660027712B /* JMCallKitListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA0B209A0F660027712B /* JMCallKitListener.swift */; };
44 44
 		C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
45 45
 		C6CC49AF207412CF000DFA42 /* PiPViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */; };
46
+		DE65AACA2317FFCD00290BEC /* LogUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = DE65AAC92317FFCD00290BEC /* LogUtils.h */; };
47
+		DE65AACC2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DE65AACB2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h */; };
46 48
 		DE762DB422AFDE76000DEBD6 /* JitsiMeetUserInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DE762DB322AFDE76000DEBD6 /* JitsiMeetUserInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
47 49
 		DE762DB622AFDE8D000DEBD6 /* JitsiMeetUserInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = DE762DB522AFDE8D000DEBD6 /* JitsiMeetUserInfo.m */; };
50
+		DE81A2D42316AC4D00AE1940 /* JitsiMeetLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = DE81A2D22316AC4D00AE1940 /* JitsiMeetLogger.h */; settings = {ATTRIBUTES = (Public, ); }; };
51
+		DE81A2D52316AC4D00AE1940 /* JitsiMeetLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = DE81A2D32316AC4D00AE1940 /* JitsiMeetLogger.m */; };
52
+		DE81A2D92316AC7600AE1940 /* LogBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = DE81A2D72316AC7600AE1940 /* LogBridge.m */; };
53
+		DE81A2DE2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = DE81A2DC2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
54
+		DE81A2DF2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = DE81A2DD2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m */; };
48 55
 		DEAD3226220C497000E93636 /* JitsiMeetConferenceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
49 56
 		DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */; };
50 57
 		DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAFA778229EAD520033A7FA /* RNRootView.m */; };
@@ -77,8 +84,6 @@
77 84
 		0BD906E51EC0C00300C8C18E /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
78 85
 		0BD906E81EC0C00300C8C18E /* JitsiMeet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeet.h; sourceTree = "<group>"; };
79 86
 		0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
80
-		C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOff.mp3; path = ../../sounds/liveStreamingOff.mp3; sourceTree = "<group>"; };
81
-		C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOn.mp3; path = ../../sounds/liveStreamingOn.mp3; sourceTree = "<group>"; };
82 87
 		6C31EDC720C06D490089C899 /* recordingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOn.mp3; path = ../../sounds/recordingOn.mp3; sourceTree = "<group>"; };
83 88
 		6C31EDC920C06D530089C899 /* recordingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = recordingOff.mp3; path = ../../sounds/recordingOff.mp3; sourceTree = "<group>"; };
84 89
 		75635B0820751D6D00F29C9F /* joined.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = joined.wav; path = ../../sounds/joined.wav; sourceTree = "<group>"; };
@@ -90,6 +95,8 @@
90 95
 		A480429B21EE335600289B73 /* AmplitudeModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AmplitudeModule.m; path = src/analytics/AmplitudeModule.m; sourceTree = SOURCE_ROOT; };
91 96
 		A4A934E8212F3ADB001E9388 /* Dropbox.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Dropbox.m; sourceTree = "<group>"; };
92 97
 		A4A934EB21349A06001E9388 /* Dropbox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Dropbox.h; sourceTree = "<group>"; };
98
+		C30F88D1CB0F4F5593216D24 /* liveStreamingOff.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOff.mp3; path = ../../sounds/liveStreamingOff.mp3; sourceTree = "<group>"; };
99
+		C30F88D3CB0F4F5593216D24 /* liveStreamingOn.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = liveStreamingOn.mp3; path = ../../sounds/liveStreamingOn.mp3; sourceTree = "<group>"; };
93 100
 		C6245F5B2053091D0040BE68 /* image-resize@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "image-resize@2x.png"; path = "src/picture-in-picture/image-resize@2x.png"; sourceTree = "<group>"; };
94 101
 		C6245F5C2053091D0040BE68 /* image-resize@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "image-resize@3x.png"; path = "src/picture-in-picture/image-resize@3x.png"; sourceTree = "<group>"; };
95 102
 		C69EFA09209A0F650027712B /* JMCallKitEmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMCallKitEmitter.swift; sourceTree = "<group>"; };
@@ -98,9 +105,16 @@
98 105
 		C6A3425E204EF76800E062DD /* DragGestureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragGestureController.swift; sourceTree = "<group>"; };
99 106
 		C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiPViewCoordinator.swift; sourceTree = "<group>"; };
100 107
 		C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
108
+		DE65AAC92317FFCD00290BEC /* LogUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LogUtils.h; sourceTree = "<group>"; };
109
+		DE65AACB2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetBaseLogHandler+Private.h"; sourceTree = "<group>"; };
101 110
 		DE762DB322AFDE76000DEBD6 /* JitsiMeetUserInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetUserInfo.h; sourceTree = "<group>"; };
102 111
 		DE762DB522AFDE8D000DEBD6 /* JitsiMeetUserInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetUserInfo.m; sourceTree = "<group>"; };
103 112
 		DE762DB722AFE166000DEBD6 /* JitsiMeetUserInfo+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetUserInfo+Private.h"; sourceTree = "<group>"; };
113
+		DE81A2D22316AC4D00AE1940 /* JitsiMeetLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetLogger.h; sourceTree = "<group>"; };
114
+		DE81A2D32316AC4D00AE1940 /* JitsiMeetLogger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetLogger.m; sourceTree = "<group>"; };
115
+		DE81A2D72316AC7600AE1940 /* LogBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LogBridge.m; sourceTree = "<group>"; };
116
+		DE81A2DC2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetBaseLogHandler.h; sourceTree = "<group>"; };
117
+		DE81A2DD2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetBaseLogHandler.m; sourceTree = "<group>"; };
104 118
 		DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetConferenceOptions.h; sourceTree = "<group>"; };
105 119
 		DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetConferenceOptions.m; sourceTree = "<group>"; };
106 120
 		DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetConferenceOptions+Private.h"; sourceTree = "<group>"; };
@@ -186,8 +200,15 @@
186 200
 				DE762DB322AFDE76000DEBD6 /* JitsiMeetUserInfo.h */,
187 201
 				DE762DB722AFE166000DEBD6 /* JitsiMeetUserInfo+Private.h */,
188 202
 				DE762DB522AFDE8D000DEBD6 /* JitsiMeetUserInfo.m */,
203
+				DE81A2D22316AC4D00AE1940 /* JitsiMeetLogger.h */,
204
+				DE81A2D32316AC4D00AE1940 /* JitsiMeetLogger.m */,
205
+				DE81A2DC2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h */,
206
+				DE65AACB2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h */,
207
+				DE81A2DD2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m */,
189 208
 				0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */,
190 209
 				0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */,
210
+				DE81A2D72316AC7600AE1940 /* LogBridge.m */,
211
+				DE65AAC92317FFCD00290BEC /* LogUtils.h */,
191 212
 				DEAFA777229EAD3B0033A7FA /* RNRootView.h */,
192 213
 				DEAFA778229EAD520033A7FA /* RNRootView.m */,
193 214
 				C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */,
@@ -273,8 +294,12 @@
273 294
 				DE762DB422AFDE76000DEBD6 /* JitsiMeetUserInfo.h in Headers */,
274 295
 				0B412F181EDEC65D00B1A0A6 /* JitsiMeetView.h in Headers */,
275 296
 				0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */,
297
+				DE81A2DE2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h in Headers */,
298
+				DE65AACC2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h in Headers */,
276 299
 				0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */,
277 300
 				0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */,
301
+				DE81A2D42316AC4D00AE1940 /* JitsiMeetLogger.h in Headers */,
302
+				DE65AACA2317FFCD00290BEC /* LogUtils.h in Headers */,
278 303
 				DEAD3226220C497000E93636 /* JitsiMeetConferenceOptions.h in Headers */,
279 304
 			);
280 305
 			runOnlyForDeploymentPostprocessing = 0;
@@ -496,7 +521,9 @@
496 521
 			buildActionMask = 2147483647;
497 522
 			files = (
498 523
 				0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
524
+				DE81A2DF2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m in Sources */,
499 525
 				0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
526
+				DE81A2D92316AC7600AE1940 /* LogBridge.m in Sources */,
500 527
 				DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */,
501 528
 				DE762DB622AFDE8D000DEBD6 /* JitsiMeetUserInfo.m in Sources */,
502 529
 				DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */,
@@ -513,6 +540,7 @@
513 540
 				C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */,
514 541
 				A4A934E9212F3ADB001E9388 /* Dropbox.m in Sources */,
515 542
 				C69EFA0D209A0F660027712B /* JMCallKitProxy.swift in Sources */,
543
+				DE81A2D52316AC4D00AE1940 /* JitsiMeetLogger.m in Sources */,
516 544
 				C69EFA0E209A0F660027712B /* JMCallKitListener.swift in Sources */,
517 545
 				0B412F191EDEC65D00B1A0A6 /* JitsiMeetView.m in Sources */,
518 546
 				DEFE535421FB1BF800011A3A /* JitsiMeet.m in Sources */,

+ 5
- 3
ios/sdk/src/AudioMode.m Ver arquivo

@@ -20,6 +20,8 @@
20 20
 #import <React/RCTLog.h>
21 21
 #import <WebRTC/WebRTC.h>
22 22
 
23
+#import "LogUtils.h"
24
+
23 25
 
24 26
 // Audio mode
25 27
 typedef enum {
@@ -167,7 +169,7 @@ RCT_EXPORT_METHOD(setMode:(int)mode
167 169
 RCT_EXPORT_METHOD(setAudioDevice:(NSString *)device
168 170
                   resolve:(RCTPromiseResolveBlock)resolve
169 171
                   reject:(RCTPromiseRejectBlock)reject) {
170
-    NSLog(@"[AudioMode] Selected device: %@", device);
172
+    DDLogInfo(@"[AudioMode] Selected device: %@", device);
171 173
     
172 174
     RTCAudioSession *session = [RTCAudioSession sharedInstance];
173 175
     [session lockForConfiguration];
@@ -260,7 +262,7 @@ RCT_EXPORT_METHOD(updateDeviceList) {
260 262
         // This is to play well with other components which could be integrated
261 263
         // into the final application.
262 264
         if (self->activeMode != kAudioModeDefault) {
263
-            NSLog(@"[AudioMode] Route changed, reapplying RTCAudioSession config");
265
+            DDLogInfo(@"[AudioMode] Route changed, reapplying RTCAudioSession config");
264 266
             RTCAudioSessionConfiguration *config = [self configForMode:self->activeMode];
265 267
             [self setConfig:config error:nil];
266 268
             if (self->forceSpeaker && !self->isSpeakerOn) {
@@ -274,7 +276,7 @@ RCT_EXPORT_METHOD(updateDeviceList) {
274 276
 }
275 277
 
276 278
 - (void)audioSession:(RTCAudioSession *)audioSession didSetActive:(BOOL)active {
277
-    NSLog(@"[AudioMode] Audio session didSetActive:%d", active);
279
+    DDLogInfo(@"[AudioMode] Audio session didSetActive:%d", active);
278 280
 }
279 281
 
280 282
 #pragma mark - Helper methods

+ 2
- 0
ios/sdk/src/JitsiMeet.h Ver arquivo

@@ -18,6 +18,8 @@
18 18
 #import <JitsiMeet/JitsiMeetView.h>
19 19
 #import <JitsiMeet/JitsiMeetViewDelegate.h>
20 20
 #import <JitsiMeet/JitsiMeetConferenceOptions.h>
21
+#import <JitsiMeet/JitsiMeetLogger.h>
22
+#import <JitsiMeet/JitsiMeetBaseLogHandler.h>
21 23
 
22 24
 
23 25
 @interface JitsiMeet : NSObject

+ 24
- 0
ios/sdk/src/JitsiMeetBaseLogHandler+Private.h Ver arquivo

@@ -0,0 +1,24 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+#import "LogUtils.h"
18
+#import "JitsiMeetBaseLogHandler.h"
19
+
20
+@interface JitsiMeetBaseLogHandler ()
21
+
22
+@property (nonatomic, retain) id<DDLogger> logger;
23
+
24
+@end

+ 28
- 0
ios/sdk/src/JitsiMeetBaseLogHandler.h Ver arquivo

@@ -0,0 +1,28 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+#import <Foundation/Foundation.h>
18
+
19
+@interface JitsiMeetBaseLogHandler : NSObject
20
+
21
+// These are "abstract".
22
+- (void)logVerbose:(NSString *)msg;
23
+- (void)logDebug:(NSString *)msg;
24
+- (void)logInfo:(NSString *)msg;
25
+- (void)logWarn:(NSString *)msg;
26
+- (void)logError:(NSString *)msg;
27
+
28
+@end

+ 105
- 0
ios/sdk/src/JitsiMeetBaseLogHandler.m Ver arquivo

@@ -0,0 +1,105 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+#import "JitsiMeetBaseLogHandler+Private.h"
18
+
19
+@interface PrivateLogger : DDAbstractLogger <DDLogger>
20
+@end
21
+
22
+@implementation PrivateLogger {
23
+    JitsiMeetBaseLogHandler *_delegate;
24
+}
25
+
26
+- (instancetype)initWithDelegate:(JitsiMeetBaseLogHandler *)delegate {
27
+    if (self = [super init]) {
28
+        _delegate = delegate;
29
+    }
30
+
31
+    return self;
32
+}
33
+
34
+#pragma mark - DDAbstractLogger interface
35
+
36
+- (void)logMessage:(DDLogMessage *)logMessage {
37
+    NSString *logMsg = logMessage.message;
38
+    
39
+    if (_logFormatter)
40
+        logMsg = [_logFormatter formatLogMessage:logMessage];
41
+    
42
+    if (logMsg && _delegate) {
43
+        switch (logMessage.flag) {
44
+            case DDLogFlagError:
45
+                [_delegate logError:logMsg];
46
+                break;
47
+            case DDLogFlagWarning:
48
+                [_delegate logWarn:logMsg];
49
+                break;
50
+            case DDLogFlagInfo:
51
+                [_delegate logInfo:logMsg];
52
+                break;
53
+            case DDLogFlagDebug:
54
+                [_delegate logDebug:logMsg];
55
+                break;
56
+            case DDLogFlagVerbose:
57
+                [_delegate logVerbose:logMsg];
58
+                break;
59
+        }
60
+    }
61
+}
62
+
63
+@end
64
+
65
+
66
+@implementation JitsiMeetBaseLogHandler
67
+
68
+#pragma mark - Proxy logger not to expose the CocoaLumberjack headers
69
+
70
+- (instancetype)init {
71
+    if (self = [super init]) {
72
+        self.logger = [[PrivateLogger alloc] initWithDelegate:self];
73
+    }
74
+
75
+    return self;
76
+}
77
+
78
+#pragma mark - Public API
79
+
80
+- (void)logVerbose:(NSString *)msg {
81
+    // Override me!
82
+    [self doesNotRecognizeSelector:_cmd];
83
+}
84
+
85
+- (void)logDebug:(NSString *)msg {
86
+    // Override me!
87
+    [self doesNotRecognizeSelector:_cmd];
88
+}
89
+
90
+- (void)logInfo:(NSString *)msg {
91
+    // Override me!
92
+    [self doesNotRecognizeSelector:_cmd];
93
+}
94
+
95
+- (void)logWarn:(NSString *)msg {
96
+    // Override me!
97
+    [self doesNotRecognizeSelector:_cmd];
98
+}
99
+
100
+- (void)logError:(NSString *)msg {
101
+    // Override me!
102
+    [self doesNotRecognizeSelector:_cmd];
103
+}
104
+
105
+@end

+ 27
- 0
ios/sdk/src/JitsiMeetLogger.h Ver arquivo

@@ -0,0 +1,27 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+#import <Foundation/Foundation.h>
18
+
19
+#import "JitsiMeetBaseLogHandler.h"
20
+
21
+
22
+@interface JitsiMeetLogger : NSObject
23
+
24
++ (void)addHandler:(JitsiMeetBaseLogHandler *)handler;
25
++ (void)removeHandler:(JitsiMeetBaseLogHandler *)handler;
26
+
27
+@end

+ 40
- 0
ios/sdk/src/JitsiMeetLogger.m Ver arquivo

@@ -0,0 +1,40 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+#import "LogUtils.h"
18
+#import "JitsiMeetLogger.h"
19
+#import "JitsiMeetBaseLogHandler+Private.h"
20
+
21
+
22
+@implementation JitsiMeetLogger
23
+
24
+/**
25
+* This gets called automagically when the program starts.
26
+*/
27
+__attribute__((constructor))
28
+static void initializeLogger() {
29
+    [DDLog addLogger:[DDOSLogger sharedInstance]];
30
+}
31
+
32
++ (void)addHandler:(JitsiMeetBaseLogHandler *)handler {
33
+    [DDLog addLogger:handler.logger];
34
+}
35
+
36
++ (void)removeHandler:(JitsiMeetBaseLogHandler *)handler {
37
+    [DDLog removeLogger:handler.logger];
38
+}
39
+
40
+@end

+ 57
- 0
ios/sdk/src/LogBridge.m Ver arquivo

@@ -0,0 +1,57 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+#import <React/RCTBridgeModule.h>
18
+
19
+#import "LogUtils.h"
20
+
21
+
22
+@interface LogBridge : NSObject<RCTBridgeModule>
23
+@end
24
+
25
+@implementation LogBridge
26
+
27
+RCT_EXPORT_MODULE();
28
+
29
++ (BOOL)requiresMainQueueSetup {
30
+    return NO;
31
+}
32
+
33
+RCT_EXPORT_METHOD(trace:(NSString *)msg) {
34
+    DDLogDebug(@"%@", msg);
35
+}
36
+
37
+RCT_EXPORT_METHOD(debug:(NSString *)msg) {
38
+    DDLogDebug(@"%@", msg);
39
+}
40
+
41
+RCT_EXPORT_METHOD(info:(NSString *)msg) {
42
+    DDLogInfo(@"%@", msg);
43
+}
44
+
45
+RCT_EXPORT_METHOD(log:(NSString *)msg) {
46
+    DDLogInfo(@"%@", msg);
47
+}
48
+
49
+RCT_EXPORT_METHOD(warn:(NSString *)msg) {
50
+    DDLogWarn(@"%@", msg);
51
+}
52
+
53
+RCT_EXPORT_METHOD(error:(NSString *)msg) {
54
+    DDLogError(@"%@", msg);
55
+}
56
+
57
+@end

+ 23
- 0
ios/sdk/src/LogUtils.h Ver arquivo

@@ -0,0 +1,23 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+#ifndef JM_LOG_UTILS_H
18
+#define JM_LOG_UTILS_H
19
+
20
+#import <CocoaLumberjack/CocoaLumberjack.h>
21
+static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
22
+
23
+#endif

+ 4
- 2
ios/sdk/src/analytics/AmplitudeModule.m Ver arquivo

@@ -15,10 +15,12 @@
15 15
  */
16 16
 
17 17
 #import <React/RCTBridgeModule.h>
18
+
18 19
 #import "Amplitude.h"
20
+#import "LogUtils.h"
19 21
 
20
-@interface AmplitudeModule : NSObject<RCTBridgeModule>
21 22
 
23
+@interface AmplitudeModule : NSObject<RCTBridgeModule>
22 24
 @end
23 25
 
24 26
 @implementation AmplitudeModule
@@ -50,7 +52,7 @@ RCT_EXPORT_METHOD(logEvent:(NSString*)instanceName eventType:(NSString*)eventTyp
50 52
                                                                    options:NSJSONReadingMutableContainers
51 53
                                                                      error:&error];
52 54
     if (eventProperties == nil) {
53
-        NSLog(@"[Amplitude handler] Error parsing event properties: %@", error);
55
+        DDLogError(@"[Amplitude] Error parsing event properties: %@", error);
54 56
     } else {
55 57
         [[Amplitude instanceWithName:instanceName] logEvent:eventType withEventProperties:eventProperties];
56 58
     }

+ 22
- 54
ios/sdk/src/callkit/CallKit.m Ver arquivo

@@ -30,6 +30,9 @@
30 30
 
31 31
 #import <JitsiMeet/JitsiMeet-Swift.h>
32 32
 
33
+#import "LogUtils.h"
34
+
35
+
33 36
 // The events emitted/supported by RNCallKit:
34 37
 static NSString * const RNCallKitPerformAnswerCallAction
35 38
     = @"performAnswerCallAction";
@@ -69,9 +72,7 @@ RCT_EXPORT_MODULE();
69 72
 RCT_EXPORT_METHOD(endCall:(NSString *)callUUID
70 73
                   resolve:(RCTPromiseResolveBlock)resolve
71 74
                    reject:(RCTPromiseRejectBlock)reject) {
72
-#ifdef DEBUG
73
-    NSLog(@"[RNCallKit][endCall] callUUID = %@", callUUID);
74
-#endif
75
+    DDLogInfo(@"[RNCallKit][endCall] callUUID = %@", callUUID);
75 76
 
76 77
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
77 78
 
@@ -92,9 +93,7 @@ RCT_EXPORT_METHOD(setMuted:(NSString *)callUUID
92 93
                      muted:(BOOL)muted
93 94
                    resolve:(RCTPromiseResolveBlock)resolve
94 95
                     reject:(RCTPromiseRejectBlock)reject) {
95
-#ifdef DEBUG
96
-    NSLog(@"[RNCallKit][setMuted] callUUID = %@", callUUID);
97
-#endif
96
+    DDLogInfo(@"[RNCallKit][setMuted] callUUID = %@", callUUID);
98 97
 
99 98
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
100 99
 
@@ -111,11 +110,7 @@ RCT_EXPORT_METHOD(setMuted:(NSString *)callUUID
111 110
 }
112 111
 
113 112
 RCT_EXPORT_METHOD(setProviderConfiguration:(NSDictionary *)dictionary) {
114
-#ifdef DEBUG
115
-    NSLog(
116
-        @"[RNCallKit][setProviderConfiguration:] dictionary = %@",
117
-        dictionary);
118
-#endif
113
+    DDLogInfo(@"[RNCallKit][setProviderConfiguration:] dictionary = %@", dictionary);
119 114
 
120 115
     if (![JMCallKitProxy isProviderConfigured]) {
121 116
         [self configureProviderFromDictionary:dictionary];
@@ -131,9 +126,7 @@ RCT_EXPORT_METHOD(startCall:(NSString *)callUUID
131 126
                       video:(BOOL)video
132 127
                     resolve:(RCTPromiseResolveBlock)resolve
133 128
                      reject:(RCTPromiseRejectBlock)reject) {
134
-#ifdef DEBUG
135
-    NSLog(@"[RNCallKit][startCall] callUUID = %@", callUUID);
136
-#endif
129
+    DDLogInfo(@"[RNCallKit][startCall] callUUID = %@", callUUID);
137 130
 
138 131
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
139 132
 
@@ -197,12 +190,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
197 190
                      options:(NSDictionary *)options
198 191
                      resolve:(RCTPromiseResolveBlock)resolve
199 192
                       reject:(RCTPromiseRejectBlock)reject) {
200
-#ifdef DEBUG
201
-    NSLog(
202
-        @"[RNCallKit][updateCall] callUUID = %@ options = %@",
203
-        callUUID,
204
-        options);
205
-#endif
193
+    DDLogInfo(@"[RNCallKit][updateCall] callUUID = %@ options = %@", callUUID, options);
206 194
 
207 195
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
208 196
 
@@ -225,9 +213,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
225 213
 #pragma mark - Helper methods
226 214
 
227 215
 - (void)configureProviderFromDictionary:(NSDictionary* )dictionary {
228
-#ifdef DEBUG
229
-    NSLog(@"[RNCallKit][providerConfigurationFromDictionary:]");
230
-#endif
216
+    DDLogInfo(@"[RNCallKit][providerConfigurationFromDictionary: %@]", dictionary);
231 217
 
232 218
     if (!dictionary) {
233 219
         dictionary = @{};
@@ -271,17 +257,12 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
271 257
 - (void)requestTransaction:(CXTransaction *)transaction
272 258
                    resolve:(RCTPromiseResolveBlock)resolve
273 259
                     reject:(RCTPromiseRejectBlock)reject {
274
-#ifdef DEBUG
275
-    NSLog(@"[RNCallKit][requestTransaction] transaction = %@", transaction);
276
-#endif
260
+    DDLogInfo(@"[RNCallKit][requestTransaction] transaction = %@", transaction);
277 261
 
278 262
     [JMCallKitProxy request:transaction
279 263
                  completion:^(NSError * _Nullable error) {
280 264
         if (error) {
281
-            NSLog(
282
-                @"[RNCallKit][requestTransaction] Error requesting transaction (%@): (%@)",
283
-                transaction.actions,
284
-                error);
265
+            DDLogError(@"[RNCallKit][requestTransaction] Error requesting transaction (%@): (%@)", transaction.actions, error);
285 266
             reject(nil, @"Error processing CallKit transaction", error);
286 267
         } else {
287 268
             resolve(nil);
@@ -293,18 +274,14 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
293 274
 
294 275
 // Called when the provider has been reset. We should terminate all calls.
295 276
 - (void)providerDidReset {
296
-#ifdef DEBUG
297
-    NSLog(@"[RNCallKit][CXProviderDelegate][providerDidReset:]");
298
-#endif
277
+    DDLogInfo(@"[RNCallKit][CXProviderDelegate][providerDidReset:]");
299 278
 
300 279
     [self sendEventWithName:RNCallKitProviderDidReset body:nil];
301 280
 }
302 281
 
303 282
 // Answering incoming call
304 283
 - (void) performAnswerCallWithUUID:(NSUUID *)UUID {
305
-#ifdef DEBUG
306
-    NSLog(@"[RNCallKit][CXProviderDelegate][provider:performAnswerCallAction:]");
307
-#endif
284
+    DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performAnswerCallAction:]");
308 285
 
309 286
     [self sendEventWithName:RNCallKitPerformAnswerCallAction
310 287
                        body:@{ @"callUUID": UUID.UUIDString }];
@@ -312,9 +289,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
312 289
 
313 290
 // Call ended, user request
314 291
 - (void) performEndCallWithUUID:(NSUUID *)UUID {
315
-#ifdef DEBUG
316
-    NSLog(@"[RNCallKit][CXProviderDelegate][provider:performEndCallAction:]");
317
-#endif
292
+    DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performEndCallAction:]");
318 293
 
319 294
     [self sendEventWithName:RNCallKitPerformEndCallAction
320 295
                        body:@{ @"callUUID": UUID.UUIDString }];
@@ -323,9 +298,7 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
323 298
 // Handle audio mute from CallKit view
324 299
 - (void) performSetMutedCallWithUUID:(NSUUID *)UUID
325 300
                              isMuted:(BOOL)isMuted {
326
-#ifdef DEBUG
327
-    NSLog(@"[RNCallKit][CXProviderDelegate][provider:performSetMutedCallAction:]");
328
-#endif
301
+    DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performSetMutedCallAction:]");
329 302
 
330 303
     [self sendEventWithName:RNCallKitPerformSetMutedCallAction
331 304
                        body:@{
@@ -337,31 +310,26 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
337 310
 // Starting outgoing call
338 311
 - (void) performStartCallWithUUID:(NSUUID *)UUID
339 312
                           isVideo:(BOOL)isVideo {
340
-#ifdef DEBUG
341
-    NSLog(@"[RNCallKit][CXProviderDelegate][provider:performStartCallAction:]");
342
-#endif
313
+    DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:performStartCallAction:]");
314
+
343 315
     [JMCallKitProxy reportOutgoingCallWith:UUID
344 316
                        startedConnectingAt:nil];
345 317
 }
346 318
 
347 319
 - (void) providerDidActivateAudioSessionWithSession:(AVAudioSession *)session {
348
-#ifdef DEBUG
349
-    NSLog(@"[RNCallKit][CXProviderDelegate][provider:didActivateAudioSession:]");
350
-#endif
320
+    DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didActivateAudioSession:]");
321
+
351 322
     [[RTCAudioSession sharedInstance] audioSessionDidActivate:session];
352 323
 }
353 324
 
354 325
 - (void) providerDidDeactivateAudioSessionWithSession:(AVAudioSession *)session {
355
-#ifdef DEBUG
356
-    NSLog(@"[RNCallKit][CXProviderDelegate][provider:didDeactivateAudioSession:]");
357
-#endif
326
+    DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didDeactivateAudioSession:]");
327
+
358 328
     [[RTCAudioSession sharedInstance] audioSessionDidDeactivate:session];
359 329
 }
360 330
 
361 331
 - (void) providerTimedOutPerformingActionWithAction:(CXAction *)action {
362
-#ifdef DEBUG
363
-    NSLog(@"[RNCallKit][CXProviderDelegate][provider:timedOutPerformingAction:]");
364
-#endif
332
+    DDLogWarn(@"[RNCallKit][CXProviderDelegate][provider:timedOutPerformingAction:]");
365 333
 }
366 334
 
367 335
 

+ 111
- 11
package-lock.json Ver arquivo

@@ -8100,8 +8100,7 @@
8100 8100
     "function-bind": {
8101 8101
       "version": "1.1.1",
8102 8102
       "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
8103
-      "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
8104
-      "dev": true
8103
+      "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
8105 8104
     },
8106 8105
     "functional-red-black-tree": {
8107 8106
       "version": "1.0.1",
@@ -8306,7 +8305,6 @@
8306 8305
       "version": "1.0.1",
8307 8306
       "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz",
8308 8307
       "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=",
8309
-      "dev": true,
8310 8308
       "requires": {
8311 8309
         "function-bind": "^1.0.2"
8312 8310
       }
@@ -8325,6 +8323,11 @@
8325 8323
       "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz",
8326 8324
       "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo="
8327 8325
     },
8326
+    "has-symbols": {
8327
+      "version": "1.0.0",
8328
+      "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
8329
+      "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q="
8330
+    },
8328 8331
     "has-unicode": {
8329 8332
       "version": "2.0.1",
8330 8333
       "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
@@ -9305,6 +9308,11 @@
9305 9308
         "kind-of": "^3.0.2"
9306 9309
       }
9307 9310
     },
9311
+    "is-arguments": {
9312
+      "version": "1.0.4",
9313
+      "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz",
9314
+      "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA=="
9315
+    },
9308 9316
     "is-arrayish": {
9309 9317
       "version": "0.2.1",
9310 9318
       "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
@@ -9357,8 +9365,7 @@
9357 9365
     "is-date-object": {
9358 9366
       "version": "1.0.1",
9359 9367
       "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
9360
-      "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
9361
-      "dev": true
9368
+      "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY="
9362 9369
     },
9363 9370
     "is-descriptor": {
9364 9371
       "version": "0.1.6",
@@ -9401,6 +9408,11 @@
9401 9408
       "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
9402 9409
       "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
9403 9410
     },
9411
+    "is-generator-function": {
9412
+      "version": "1.0.7",
9413
+      "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz",
9414
+      "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw=="
9415
+    },
9404 9416
     "is-number": {
9405 9417
       "version": "3.0.0",
9406 9418
       "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
@@ -9456,7 +9468,6 @@
9456 9468
       "version": "1.0.4",
9457 9469
       "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
9458 9470
       "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
9459
-      "dev": true,
9460 9471
       "requires": {
9461 9472
         "has": "^1.0.1"
9462 9473
       }
@@ -12032,6 +12043,15 @@
12032 12043
           "requires": {
12033 12044
             "safe-buffer": "~5.1.0"
12034 12045
           }
12046
+        },
12047
+        "util": {
12048
+          "version": "0.10.4",
12049
+          "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
12050
+          "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
12051
+          "dev": true,
12052
+          "requires": {
12053
+            "inherits": "2.0.3"
12054
+          }
12035 12055
         }
12036 12056
       }
12037 12057
     },
@@ -12285,6 +12305,76 @@
12285 12305
         "isobject": "^3.0.0"
12286 12306
       }
12287 12307
     },
12308
+    "object.entries": {
12309
+      "version": "1.1.0",
12310
+      "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.0.tgz",
12311
+      "integrity": "sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA==",
12312
+      "requires": {
12313
+        "define-properties": "^1.1.3",
12314
+        "es-abstract": "^1.12.0",
12315
+        "function-bind": "^1.1.1",
12316
+        "has": "^1.0.3"
12317
+      },
12318
+      "dependencies": {
12319
+        "define-properties": {
12320
+          "version": "1.1.3",
12321
+          "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
12322
+          "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
12323
+          "requires": {
12324
+            "object-keys": "^1.0.12"
12325
+          }
12326
+        },
12327
+        "es-abstract": {
12328
+          "version": "1.13.0",
12329
+          "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz",
12330
+          "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==",
12331
+          "requires": {
12332
+            "es-to-primitive": "^1.2.0",
12333
+            "function-bind": "^1.1.1",
12334
+            "has": "^1.0.3",
12335
+            "is-callable": "^1.1.4",
12336
+            "is-regex": "^1.0.4",
12337
+            "object-keys": "^1.0.12"
12338
+          }
12339
+        },
12340
+        "es-to-primitive": {
12341
+          "version": "1.2.0",
12342
+          "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
12343
+          "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==",
12344
+          "requires": {
12345
+            "is-callable": "^1.1.4",
12346
+            "is-date-object": "^1.0.1",
12347
+            "is-symbol": "^1.0.2"
12348
+          }
12349
+        },
12350
+        "has": {
12351
+          "version": "1.0.3",
12352
+          "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
12353
+          "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
12354
+          "requires": {
12355
+            "function-bind": "^1.1.1"
12356
+          }
12357
+        },
12358
+        "is-callable": {
12359
+          "version": "1.1.4",
12360
+          "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
12361
+          "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA=="
12362
+        },
12363
+        "is-symbol": {
12364
+          "version": "1.0.2",
12365
+          "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
12366
+          "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
12367
+          "requires": {
12368
+            "has-symbols": "^1.0.0"
12369
+          }
12370
+        },
12371
+        "object-keys": {
12372
+          "version": "1.1.1",
12373
+          "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
12374
+          "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
12375
+        }
12376
+      }
12377
+    },
12288 12378
     "object.getownpropertydescriptors": {
12289 12379
       "version": "2.0.3",
12290 12380
       "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
@@ -17339,12 +17429,22 @@
17339 17429
       "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ=="
17340 17430
     },
17341 17431
     "util": {
17342
-      "version": "0.10.4",
17343
-      "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
17344
-      "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
17345
-      "dev": true,
17432
+      "version": "0.12.1",
17433
+      "resolved": "https://registry.npmjs.org/util/-/util-0.12.1.tgz",
17434
+      "integrity": "sha512-MREAtYOp+GTt9/+kwf00IYoHZyjM8VU4aVrkzUlejyqaIjd2GztVl5V9hGXKlvBKE3gENn/FMfHE5v6hElXGcQ==",
17346 17435
       "requires": {
17347
-        "inherits": "2.0.3"
17436
+        "inherits": "^2.0.3",
17437
+        "is-arguments": "^1.0.4",
17438
+        "is-generator-function": "^1.0.7",
17439
+        "object.entries": "^1.1.0",
17440
+        "safe-buffer": "^5.1.2"
17441
+      },
17442
+      "dependencies": {
17443
+        "safe-buffer": {
17444
+          "version": "5.2.0",
17445
+          "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
17446
+          "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
17447
+        }
17348 17448
       }
17349 17449
     },
17350 17450
     "util-deprecate": {

+ 1
- 0
package.json Ver arquivo

@@ -86,6 +86,7 @@
86 86
     "redux": "4.0.4",
87 87
     "redux-thunk": "2.2.0",
88 88
     "styled-components": "3.4.9",
89
+    "util": "0.12.1",
89 90
     "uuid": "3.1.0",
90 91
     "windows-iana": "^3.1.0",
91 92
     "xmldom": "0.1.27"

+ 65
- 0
react/features/base/logging/LogTransport.native.js Ver arquivo

@@ -0,0 +1,65 @@
1
+// @flow
2
+
3
+import { NativeModules } from 'react-native';
4
+import { format } from 'util';
5
+
6
+// Some code adapted from https://github.com/houserater/react-native-lumberjack
7
+// License: MIT
8
+
9
+const { LogBridge } = NativeModules;
10
+
11
+/**
12
+ * Returns the stack trace for a given @code {Error} object.
13
+ *
14
+ * @param {Errror} e - The rrror.
15
+ * @returns {string} - The stack trace.
16
+ */
17
+function stackToString(e) {
18
+    let ce;
19
+    let s = e.stack;
20
+
21
+    if (typeof e.cause === 'function' && (ce = e.cause())) {
22
+        s += `\nCaused by: ${stackToString(ce)}`;
23
+    }
24
+
25
+    return s;
26
+}
27
+
28
+/**
29
+ * Constructs a log transport object for use with jitsi-meet-logger.
30
+ *
31
+ * @returns {Object} - The transport object.
32
+ */
33
+function buildTransport() {
34
+    return [
35
+        'trace',
36
+        'debug',
37
+        'info',
38
+        'log',
39
+        'warn',
40
+        'error'
41
+    ].reduce((logger, logName) => {
42
+        logger[logName] = (...args: Array<string>) => {
43
+            const nargs = args.map(arg => {
44
+                if (arg instanceof Error) {
45
+                    const errorBody = {
46
+                        message: arg.message,
47
+                        code: arg.code,
48
+                        stack: stackToString(arg)
49
+                    };
50
+
51
+                    return `Error(${arg.name})${JSON.stringify(errorBody)}`;
52
+                }
53
+
54
+                return arg;
55
+            });
56
+            const message = format(...nargs);
57
+
58
+            LogBridge[logName](message);
59
+        };
60
+
61
+        return logger;
62
+    }, {});
63
+}
64
+
65
+export default buildTransport();

+ 0
- 0
react/features/base/logging/LogTransport.web.js Ver arquivo


+ 23
- 1
react/features/base/logging/functions.js Ver arquivo

@@ -1,6 +1,9 @@
1 1
 // @flow
2 2
 
3
-import { getLogger as _getLogger } from 'jitsi-meet-logger';
3
+import _ from 'lodash';
4
+import Logger, { getLogger as _getLogger } from 'jitsi-meet-logger';
5
+
6
+import LogTransport from './LogTransport';
4 7
 
5 8
 /**
6 9
  * Options for building the logger. We disable the callee info on RN because it's
@@ -20,3 +23,22 @@ export function getLogger(id: string) {
20 23
 
21 24
     return _getLogger(id, undefined, opts);
22 25
 }
26
+
27
+/**
28
+ * Initializes native logging. This operations must be done as early as possible.
29
+ */
30
+export const _initLogging = _.once(() => {
31
+    if (navigator.product !== 'ReactNative') {
32
+        return;
33
+    }
34
+
35
+    // Lazy load it to avoid cycles in early web bootstrap code.
36
+    const { default: JitsiMeetJS } = require('../lib-jitsi-meet');
37
+
38
+    Logger.setGlobalOptions(DEFAULT_RN_OPTS);
39
+    JitsiMeetJS.setGlobalLogOptions(DEFAULT_RN_OPTS);
40
+    Logger.removeGlobalTransport(console);
41
+    JitsiMeetJS.removeGlobalLogTransport(console);
42
+    Logger.addGlobalTransport(LogTransport);
43
+    JitsiMeetJS.addGlobalLogTransport(LogTransport);
44
+});

+ 0
- 6
react/features/base/logging/middleware.js Ver arquivo

@@ -163,12 +163,6 @@ function _initLogging({ dispatch, getState }, loggingConfig, isTestingEnabled) {
163 163
         logCollector.stop();
164 164
         dispatch(setLogCollector(undefined));
165 165
     }
166
-
167
-    // Disable caller function info.
168
-    if (navigator.product === 'ReactNative') {
169
-        Logger.setGlobalOptions({ disableCallerInfo: true });
170
-        JitsiMeetJS.setGlobalLogOptions({ disableCallerInfo: true });
171
-    }
172 166
 }
173 167
 
174 168
 /**

+ 6
- 0
react/index.native.js Ver arquivo

@@ -16,6 +16,9 @@ import { AppRegistry } from 'react-native';
16 16
 import { App } from './features/app';
17 17
 import { IncomingCallApp } from './features/mobile/incoming-call';
18 18
 
19
+// It's crucial that the native loggers are created ASAP, not to lose any data.
20
+import { _initLogging } from './features/base/logging/functions';
21
+
19 22
 declare var __DEV__;
20 23
 
21 24
 /**
@@ -51,6 +54,9 @@ class Root extends PureComponent<Props> {
51 54
     }
52 55
 }
53 56
 
57
+// Initialize logging.
58
+_initLogging();
59
+
54 60
 // HORRIBLE HACK ALERT! React Native logs the initial props with `console.log`. Here we are quickly patching it
55 61
 // to avoid logging potentially sensitive information.
56 62
 if (!__DEV__) {

Carregando…
Cancelar
Salvar