Exemplo n.º 1
0
        protected override void Append(LoggingEvent loggingEvent)
        {
            NativeError nativeError = null;

            // Render the event in the callers security context
            string renderedLoggingEvent = RenderLoggingEvent(loggingEvent);

            using (m_securityContext.Impersonate(this))
            {
                // Send the message
                int returnValue = NetMessageBufferSend(this.Server, this.Recipient, this.Sender, renderedLoggingEvent, renderedLoggingEvent.Length * Marshal.SystemDefaultCharSize);

                // Log the error if the message could not be sent
                if (returnValue != 0)
                {
                    // Lookup the native error
                    nativeError = NativeError.GetError(returnValue);
                }
            }

            if (nativeError != null)
            {
                // Handle the error over to the ErrorHandler
                ErrorHandler.Error(nativeError.ToString() + " (Params: Server=" + this.Server + ", Recipient=" + this.Recipient + ", Sender=" + this.Sender + ")");
            }
        }