Ejemplo n.º 1
0
        private void AssignDelegatesToNative(ILoggerProvider provider)
        {
            var providererroreventhandler         = new ProviderErrorEventHandler(provider.OnError);
            var providerfailtolog                 = new ProviderFailToLog(provider.OnFailToLog);
            var providercriticalerroreventhandler = new ProviderCriticalErrorEventHandler(provider.OnCriticalError);
            var providerQueueError                = new ProviderQueueErrorEventHandler(provider.OnQueueError);
            var providerRestartEvent              = new ProviderRestartEventHandler(provider.OnRestart);
            var providerSendLimits                = new ProviderSendLimits(provider.OnSendLimitsReached);
            var providerStartEventHandler         = new ProviderStartEventHandler(provider.OnStarted);
            var providerStatusChanged             = new ProviderStatusChangedEventHandler(provider.OnStatusChanged);

            delegates.Add(providererroreventhandler);
            delegates.Add(providerfailtolog);
            delegates.Add(providercriticalerroreventhandler);
            delegates.Add(providerQueueError);
            delegates.Add(providerRestartEvent);
            delegates.Add(providerSendLimits);
            delegates.Add(providerStartEventHandler);
            delegates.Add(providerStatusChanged);

            addWrapperErrorDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providererroreventhandler));
            addWrapperFailDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providerfailtolog));
            addWrapperCriticalErrorDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providercriticalerroreventhandler));
            addWrapperQueueErrorDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providerQueueError));
            addWrapperRestartDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providerRestartEvent));
            addWrapperSendLimitsDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providerSendLimits));
            addWrapperStartDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providerStartEventHandler));
            addWrapperStatusChangedDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(providerStatusChanged));
        }
Ejemplo n.º 2
0
 private void AssignDelegatesToNative(ILoggerProvider provider)
 {
     addWrapperErrorDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderErrorEventHandler(provider.OnError)));
     addWrapperFailDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderFailToLog(provider.OnFaliToLog)));
     addWrapperCriticalErrorDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderCriticalErrorEventHandler(provider.OnCriticalError)));
     addWrapperQueueErrorDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderQueueErrorEventHandler(provider.OnQueueError)));
     addWrapperRestartDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderRestartEventHandler(provider.OnRestart)));
     addWrapperSendLimitsDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderSendLimits(provider.OnSendLimitsReached)));
     addWrapperStartDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderStartEventHandler(provider.OnStarted)));
     addWrapperStatusChangedDelegateNative?.Invoke(provider.getProviderProperties().GetProviderName(), Marshal.GetFunctionPointerForDelegate(new ProviderStatusChangedEventHandler(provider.OnStatusChanged)));
 }