Make CameraLogger ThreadSafe (#779)

Co-authored-by: Mattia Iavarone <mat.iavarone@gmail.com>
pull/775/head
Alexander 5 years ago committed by GitHub
parent aa95d19902
commit 858495afde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraLogger.java

@ -1,16 +1,16 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.util.Log;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import android.util.Log;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList; import java.util.Set;
import java.util.List; import java.util.concurrent.CopyOnWriteArraySet;
/** /**
* Utility class that can log traces and info. * Utility class that can log traces and info.
@ -59,7 +59,7 @@ public final class CameraLogger {
@VisibleForTesting static String lastTag; @VisibleForTesting static String lastTag;
private static int sLevel; private static int sLevel;
private static List<Logger> sLoggers = new ArrayList<>(); private static Set<Logger> sLoggers = new CopyOnWriteArraySet<>();
@VisibleForTesting static Logger sAndroidLogger = new Logger() { @VisibleForTesting static Logger sAndroidLogger = new Logger() {
@Override @Override

Loading…
Cancel
Save