private static void _Subscribe(LogCallback onLog) { // Separate function because the native call will make C# atempt // to load the library as soon as it enters this method. callbacks.Add(onLog); // This prevents the callback from getting GCed NativeAPI.log_subscribe(onLog); }
/// <summary>Allows you to listen in on log events! Any callback subscribed here will be called when /// something is logged. This does honor the Log.Filter, so filtered logs will not be received here.</summary> /// <param name="onLog">The function to call when a log event occurs.</param> public static void Subscribe(LogCallback onLog) { callbacks.Add(onLog); // This prevents the callback from getting GCed NativeAPI.log_subscribe(onLog); }