예제 #1
0
        protected override void Write(LogEventInfo logEvent)
        {
            // If we have a real exception, we can log it as is, otherwise we can take the NLog message and use that.
            if (IsException(logEvent))
            {
                Exception exception = (Exception)logEvent.Parameters.First();

                List <string> tags = ExtractTagsFromException(exception);

                RaygunClient raygunClient = CreateRaygunClient();
                SendMessage(raygunClient, exception, tags);
            }
            else if (IsWebException(logEvent))
            {
                ExceptionContext exceptionContext = (ExceptionContext)logEvent.Parameters.First();
                ProcessWebException(exceptionContext);
            }
            else
            {
                string logMessage = Layout.Render(logEvent);

                RaygunException exception = new RaygunException(logMessage, logEvent.Exception);
                RaygunClient    client    = CreateRaygunClient();

                SendMessage(client, exception, new List <string>());
            }
        }
예제 #2
0
        protected override void Write(LogEventInfo logEvent)
        {
            // If we have a real exception, we can log it as is, otherwise we can take the NLog message and use that.
            if (IsException(logEvent))
            {
                Exception exception = (Exception)logEvent.Parameters.First();

                List<string> tags = ExtractTagsFromException(exception);
                IDictionary customData = ExtractCustomDataFromException(exception);

                RaygunClient raygunClient = CreateRaygunClient();
                SendMessage(raygunClient, exception, tags, customData);
            }
            else
            {
                string logMessage = Layout.Render(logEvent);

                RaygunException exception = new RaygunException(logMessage, logEvent.Exception);
                RaygunClient client = CreateRaygunClient();

                List<string> tags = ExtractTagsFromException(logEvent.Exception ?? exception);
                IDictionary customData = ExtractCustomDataFromException(logEvent.Exception ??  exception);

                SendMessage(client, exception, tags, customData);
            }
        }
예제 #3
0
        protected override void Write(LogEventInfo logEvent)
        {
            _raygunClient = _raygunClient ?? (_raygunClient = CreateRaygunClient());

            Exception exception = ExtractException(logEvent);
            var       tags      = ExtractTags(logEvent, exception);
            Dictionary <string, object> userCustomData = ExtractProperties(logEvent);
            string layoutLogMessage = Layout.Render(logEvent);

            userCustomData["RenderedLogMessage"] = layoutLogMessage;
            userCustomData["LogMessageTemplate"] = logEvent.Message;

            if (exception == null)
            {
                exception = new RaygunException(layoutLogMessage);
            }

#if NET45
            string userIdentityInfo = UserIdentityInfo != null?UserIdentityInfo.Render(logEvent) : string.Empty;

            var userIdentity = string.IsNullOrEmpty(userIdentityInfo) ? null : new Mindscape.Raygun4Net.Messages.RaygunIdentifierMessage(userIdentityInfo);
            _raygunClient.SendInBackground(exception, tags, userCustomData, userIdentity);
#else
            _raygunClient.SendInBackground(exception, tags, userCustomData);
#endif
        }
예제 #4
0
        protected override void Write(LogEventInfo logEvent)
        {
            var logMessage = Layout.Render(logEvent);

            var exception = new RaygunException(logMessage, logEvent.Exception);

            var client = CreateRaygunClient();

            SendMessage(client, exception);
        }
예제 #5
0
        protected override void Write(LogEventInfo logEvent)
        {
            var logMessage = Layout.Render(logEvent);

            var exception = new RaygunException(logMessage, logEvent.Exception);

            var client = CreateRaygunClient();

            SendMessage(client, exception);
        }