From 2af965d1ad9b3962bc38850d80489ba3749de170 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Mon, 16 Oct 2023 17:51:18 +0200 Subject: [PATCH] fix: Log in `FrameProcessorPluginRegistry` (#2012) * fix: Log when adding Frame Processor Plugin * fix: Also log on Android * Add logs in get as well * fix: Fix string concat on Android --- .../camera/frameprocessor/FrameProcessorPluginRegistry.java | 6 ++++++ package/ios/Frame Processor/FrameProcessorPluginRegistry.m | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/package/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorPluginRegistry.java b/package/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorPluginRegistry.java index 5dd974d..11a3525 100644 --- a/package/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorPluginRegistry.java +++ b/package/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorPluginRegistry.java @@ -1,5 +1,6 @@ package com.mrousavy.camera.frameprocessor; +import android.util.Log; import androidx.annotation.Keep; import androidx.annotation.Nullable; import com.facebook.proguard.annotations.DoNotStrip; @@ -10,6 +11,7 @@ import java.util.HashMap; @Keep public class FrameProcessorPluginRegistry { private static final Map Plugins = new HashMap<>(); + private static final String TAG = "FrameProcessorPluginRegistry"; @DoNotStrip @Keep @@ -17,15 +19,19 @@ public class FrameProcessorPluginRegistry { assert !Plugins.containsKey(name) : "Tried to add a Frame Processor Plugin with a name that already exists! " + "Either choose unique names, or remove the unused plugin. Name: " + name; Plugins.put(name, pluginInitializer); + Log.i(TAG, "Successfully registered Frame Processor Plugin \"" + name + "\"!"); } @DoNotStrip @Keep public static FrameProcessorPlugin getPlugin(String name, Map options) { + Log.i(TAG, "Looking up Frame Processor Plugin \"" + name + "\"..."); PluginInitializer initializer = Plugins.get(name); if (initializer == null) { + Log.i(TAG, "Frame Processor Plugin \"" + name + "\" does not exist!"); return null; } + Log.i(TAG, "Frame Processor Plugin \"" + name + "\" found! Initializing..."); return initializer.initializePlugin(options); } diff --git a/package/ios/Frame Processor/FrameProcessorPluginRegistry.m b/package/ios/Frame Processor/FrameProcessorPluginRegistry.m index 3268258..da6fb2d 100644 --- a/package/ios/Frame Processor/FrameProcessorPluginRegistry.m +++ b/package/ios/Frame Processor/FrameProcessorPluginRegistry.m @@ -28,14 +28,18 @@ name); [[FrameProcessorPluginRegistry frameProcessorPlugins] setValue:pluginInitializer forKey:name]; + NSLog(@"Successfully registered Frame Processor Plugin \"%@\"!", name); } + (FrameProcessorPlugin*)getPlugin:(NSString* _Nonnull)name withOptions:(NSDictionary* _Nullable)options { + NSLog(@"Looking up Frame Processor Plugin \"%@\"...", name); PluginInitializerFunction initializer = [[FrameProcessorPluginRegistry frameProcessorPlugins] objectForKey:name]; if (initializer == nil) { + NSLog(@"Frame Processor Plugin \"%@\" does not exist!", name); return nil; } + NSLog(@"Frame Processor Plugin \"%@\" found! Initializing...", name); return initializer(options); }