• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Messages.RaygunMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mindscape.Raygun4Net.Messages.RaygunMessage的典型用法代码示例。如果您正苦于以下问题:C# RaygunMessage类的具体用法?C# RaygunMessage怎么用?C# RaygunMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RaygunMessage类属于Mindscape.Raygun4Net.Messages命名空间,在下文中一共展示了RaygunMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnSendingMessage

    // Returns true if the message can be sent, false if the sending is canceled.
    protected bool OnSendingMessage(RaygunMessage raygunMessage)
    {
      bool result = true;

      if (!_handlingRecursiveErrorSending)
      {
        EventHandler<RaygunSendingMessageEventArgs> handler = SendingMessage;
        if (handler != null)
        {
          RaygunSendingMessageEventArgs args = new RaygunSendingMessageEventArgs(raygunMessage);
          try
          {
            handler(this, args);
          }
          catch (Exception e)
          {
            // Catch and send exceptions that occur in the SendingMessage event handler.
            // Set the _handlingRecursiveErrorSending flag to prevent infinite errors.
            _handlingRecursiveErrorSending = true;
            Send(e);
            _handlingRecursiveErrorSending = false;
          }
          result = !args.Cancel;
        }
      }

      return result;
    }
开发者ID:nelsonsar,项目名称:raygun4net,代码行数:29,代码来源:RaygunClient.cs


示例2: OnSendingMessage

 // Returns true if the message can be sent, false if the sending is canceled.
 protected bool OnSendingMessage(RaygunMessage raygunMessage)
 {
   bool result = true;
   EventHandler<RaygunSendingMessageEventArgs> handler = SendingMessage;
   if (handler != null)
   {
     RaygunSendingMessageEventArgs args = new RaygunSendingMessageEventArgs(raygunMessage);
     handler(this, args);
     result = !args.Cancel;
   }
   return result;
 }
开发者ID:ArturDorochowicz,项目名称:raygun4net,代码行数:13,代码来源:RaygunClient.cs


示例3: Emit

        /// <summary>
        /// Emit the provided log event to the sink.
        /// </summary>
        /// <param name="logEvent">The log event to write.</param>
        public void Emit(LogEvent logEvent)
        {
            //Include the log level as a tag.
            var tags = _tags.Concat(new []{logEvent.Level.ToString()}).ToList();

            var properties = logEvent.Properties
                         .Select(pv => new { Name = pv.Key, Value = RaygunPropertyFormatter.Simplify(pv.Value) })
                         .ToDictionary(a => a.Name, b => b.Value);

            // Add the message 
            properties.Add("RenderedLogMessage", logEvent.RenderMessage(_formatProvider));
            properties.Add("LogMessageTemplate", logEvent.MessageTemplate.Text);

            // Create new message
            var raygunMessage = new RaygunMessage
                                {
                                    OccurredOn = logEvent.Timestamp.UtcDateTime
                                };

            // Add exception when available
            if (logEvent.Exception != null)
                raygunMessage.Details.Error = new RaygunErrorMessage(logEvent.Exception);

            // Add user when requested
            if (!String.IsNullOrWhiteSpace(_userNameProperty) &&
                logEvent.Properties.ContainsKey(_userNameProperty) &&
                logEvent.Properties[_userNameProperty] != null)
            {
                raygunMessage.Details.User = new RaygunIdentifierMessage(logEvent.Properties[_userNameProperty].ToString());
            }

            // Add version when requested
            if (!String.IsNullOrWhiteSpace(_applicationVersionProperty) &&
                logEvent.Properties.ContainsKey(_applicationVersionProperty) &&
                logEvent.Properties[_applicationVersionProperty] != null)
            {
                raygunMessage.Details.Version = logEvent.Properties[_applicationVersionProperty].ToString();
            }

            // Build up the rest of the message
            raygunMessage.Details.Environment = new RaygunEnvironmentMessage();
            raygunMessage.Details.Tags = tags;
            raygunMessage.Details.UserCustomData = properties;
            raygunMessage.Details.MachineName = Environment.MachineName;
          
            if (HttpContext.Current != null)
                raygunMessage.Details.Request = new RaygunRequestMessage(HttpContext.Current.Request, null);

            // Submit
            _client.SendInBackground(raygunMessage);

        }
开发者ID:BugBusted,项目名称:serilog,代码行数:56,代码来源:RaygunSink.cs


示例4: CanNotSendIfExcludingStatusCode_MultipleCodes

        public void CanNotSendIfExcludingStatusCode_MultipleCodes()
        {
            RaygunSettings.Settings.ExcludeHttpStatusCodesList = "400, 404, 501";

              RaygunMessage message = new RaygunMessage
              {
            Details = new RaygunMessageDetails
            {
              Response = new RaygunResponseMessage
              {
            StatusCode = 404
              }
            }
              };

              Assert.IsFalse(_client.ExposeCanSend(message));
        }
开发者ID:nelsonsar,项目名称:raygun4net,代码行数:17,代码来源:RaygunWebApiClientTests.cs


示例5: CanSendIfMessageIsNull

        public void CanSendIfMessageIsNull()
        {
            RaygunSettings.Settings.ExcludeHttpStatusCodesList = null;

              // Null message
              Assert.IsTrue(_client.ExposeCanSend(null));

              // Null message details
              Assert.IsTrue(_client.ExposeCanSend(new RaygunMessage()));

              RaygunMessage message = new RaygunMessage
              {
            Details = new RaygunMessageDetails()
              };

              // Null message response

              Assert.IsTrue(_client.ExposeCanSend(message));
        }
开发者ID:nelsonsar,项目名称:raygun4net,代码行数:19,代码来源:RaygunWebApiClientTests.cs


示例6: Send

        /// <summary>
        /// Posts a RaygunMessage to the Raygun.io api endpoint.
        /// </summary>
        /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property
        /// set to a valid DateTime and as much of the Details property as is available.</param>
        public void Send(RaygunMessage raygunMessage)
        {
            if (ValidateApiKey())
              {
            if (HasInternetConnection)
            {
              using (var client = new WebClient())
              {
            client.Headers.Add("X-ApiKey", _apiKey);
            client.Encoding = System.Text.Encoding.UTF8;

            try
            {
              var message = SimpleJson.SerializeObject(raygunMessage);
              client.UploadString(RaygunSettings.Settings.ApiEndpoint, message);
              System.Diagnostics.Debug.WriteLine("Sending message to Raygun.io");
            }
            catch (Exception ex)
            {
              System.Diagnostics.Debug.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message));
              try
              {
                SaveMessage(SimpleJson.SerializeObject(raygunMessage));
                System.Diagnostics.Debug.WriteLine("Exception has been saved to the device to try again later.");
              }
              catch (Exception e)
              {
                System.Diagnostics.Debug.WriteLine(string.Format("Error saving Exception to device {0}", e.Message));
              }
            }
              }
            }
            else
            {
              try
              {
            var message = SimpleJson.SerializeObject(raygunMessage);
            SaveMessage(message);
              }
              catch (Exception ex)
              {
            System.Diagnostics.Debug.WriteLine(string.Format("Error saving Exception to device {0}", ex.Message));
              }
            }
              }
        }
开发者ID:KennyBu,项目名称:raygun4net,代码行数:51,代码来源:RaygunClient.cs


示例7: Send

        /// <summary>
        /// Posts a RaygunMessage to the Raygun.io api endpoint.
        /// </summary>
        /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property
        /// set to a valid DateTime and as much of the Details property as is available.</param>
        public override void Send(RaygunMessage raygunMessage)
        {
            bool canSend = OnSendingMessage(raygunMessage);
              if (canSend)
              {
            string message = null;
            try
            {
              message = SimpleJson.SerializeObject(raygunMessage);
            }
            catch (Exception ex)
            {
              System.Diagnostics.Debug.WriteLine(string.Format("Error serializing exception {0}", ex.Message));

              if (RaygunSettings.Settings.ThrowOnError)
              {
            throw;
              }
            }

            if (message != null)
            {
              try
              {
            Send(message);
              }
              catch (Exception ex)
              {
            SaveMessage(message);
            System.Diagnostics.Debug.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message));

            if (RaygunSettings.Settings.ThrowOnError)
            {
              throw;
            }
              }

              SendStoredMessages();
            }
              }
        }
开发者ID:MindscapeHQ,项目名称:raygun4net,代码行数:46,代码来源:RaygunClient.cs


示例8: Send

 /// <summary>
 /// Posts a RaygunMessage to the Raygun.io api endpoint.
 /// </summary>
 /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property
 /// set to a valid DateTime and as much of the Details property as is available.</param>
 public void Send(RaygunMessage raygunMessage)
 {
   bool calledFromUnhandled = IsCalledFromApplicationUnhandledExceptionHandler();
   Send(raygunMessage, calledFromUnhandled, false);
 }
开发者ID:ArturDorochowicz,项目名称:raygun4net,代码行数:10,代码来源:RaygunClient.cs


示例9: Send

        /// <summary>
        /// Posts a RaygunMessage to the Raygun.io api endpoint.
        /// </summary>
        /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property
        /// set to a valid DateTime and as much of the Details property as is available.</param>
        public override void Send(RaygunMessage raygunMessage)
        {
            if (ValidateApiKey())
              {
            bool canSend = OnSendingMessage(raygunMessage);
            if (canSend)
            {
              string message = null;
              try
              {
            message = SimpleJson.SerializeObject(raygunMessage);
              }
              catch (Exception ex)
              {
            System.Diagnostics.Debug.WriteLine(string.Format("Error Serializing Exception {0}", ex.Message));
              }

              if (!String.IsNullOrWhiteSpace(message))
              {
            using (var client = new WebClient())
            {
              client.Headers.Add("X-ApiKey", _apiKey);
              client.Headers.Add("content-type", "application/json; charset=utf-8");
              client.Encoding = System.Text.Encoding.UTF8;

              try
              {
                client.UploadString(RaygunSettings.Settings.ApiEndpoint, message);
              }
              catch (Exception ex)
              {
                System.Diagnostics.Debug.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message));
              }
            }
              }
            }
              }
        }
开发者ID:nelsonsar,项目名称:raygun4net,代码行数:43,代码来源:RaygunClient.cs


示例10: SendOrSave

    private async Task SendOrSave(RaygunMessage raygunMessage)
    {
      if (ValidateApiKey())
      {
        bool canSend = OnSendingMessage(raygunMessage);
        if (canSend)
        {
          try
          {
            string message = SimpleJson.SerializeObject(raygunMessage);

            if (InternetAvailable())
            {
              await SendMessage(message);
            }
            else
            {
              await SaveMessage(message);
            }
          }
          catch (Exception ex)
          {
            Debug.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message));
          }
        }
      }
    }
开发者ID:ArturDorochowicz,项目名称:raygun4net,代码行数:27,代码来源:RaygunClient.cs


示例11: RaygunMessageBuilderBase

 protected RaygunMessageBuilderBase()
 {
   _raygunMessage = new RaygunMessage();
 }
开发者ID:ArturDorochowicz,项目名称:raygun4net,代码行数:4,代码来源:RaygunMessageBuilderBase.cs


示例12: SendInBackground

 /// <summary>
 /// Asynchronously transmits a message to Raygun.
 /// </summary>
 /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property
 /// set to a valid DateTime and as much of the Details property as is available.</param>
 public Task SendInBackground(RaygunMessage raygunMessage)
 {
   return Task.Run(() => Send(raygunMessage));
 }
开发者ID:MindscapeHQ,项目名称:raygun4net,代码行数:9,代码来源:RaygunClient.cs


示例13: OnCustomGroupingKey

 protected async Task<string> OnCustomGroupingKey(Exception exception, RaygunMessage message)
 {
   string result = null;
   if (!_handlingRecursiveGrouping)
   {
     var handler = CustomGroupingKey;
     if (handler != null)
     {
       var args = new RaygunCustomGroupingKeyEventArgs(exception, message);
       try
       {
         handler(this, args);
       }
       catch (Exception e)
       {
         _handlingRecursiveGrouping = true;
         await SendAsync(e, null, null, null);
         _handlingRecursiveGrouping = false;
       }
       result = args.CustomGroupingKey;
     }
   }
   return result;
 }
开发者ID:MindscapeHQ,项目名称:raygun4net,代码行数:24,代码来源:RaygunClient.cs


示例14: FilterShouldPreventSend

 protected bool FilterShouldPreventSend(RaygunMessage raygunMessage)
 {
     return MessageSendFilter != null && !MessageSendFilter(raygunMessage);
 }
开发者ID:robfe,项目名称:raygun4net,代码行数:4,代码来源:RaygunClient.cs


示例15: SendAsync

 /// <summary>
 /// Asynchronously sends a RaygunMessage to the Raygun.io api endpoint.
 /// It is best to call this method within a try/catch block.
 /// If the application is crashing due to an unhandled exception, use the synchronous methods instead.
 /// </summary>
 /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property
 /// set to a valid DateTime and as much of the Details property as is available.</param>
 public async Task SendAsync(RaygunMessage raygunMessage)
 {
   await SendOrSave(raygunMessage);
 }
开发者ID:ArturDorochowicz,项目名称:raygun4net,代码行数:11,代码来源:RaygunClient.cs


示例16: ExposeCanSend

 public bool ExposeCanSend(RaygunMessage message)
 {
   return CanSend(message);
 }
开发者ID:WaldenL,项目名称:raygun4net,代码行数:4,代码来源:FakeRaygunWebApiClient.cs


示例17: Send

        /// <summary>
        /// Posts a RaygunMessage to the Raygun.io api endpoint.
        /// </summary>
        /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property
        /// set to a valid DateTime and as much of the Details property as is available.</param>
        public void Send(RaygunMessage raygunMessage)
        {
            if (ValidateApiKey())
              {
            bool canSend = OnSendingMessage(raygunMessage);
            if (canSend)
            {
              string message = null;

              try
              {
            message = SimpleJson.SerializeObject(raygunMessage);
              }
              catch (Exception ex)
              {
            System.Diagnostics.Debug.WriteLine(string.Format("Error serializing raygun message: {0}", ex.Message));
              }

              if (message != null)
              {
            SendMessage(message);
              }
            }
              }
        }
开发者ID:nxtplace,项目名称:raygun4net,代码行数:30,代码来源:RaygunClient.cs


示例18: ExposeFilterShouldPreventSend

 public bool ExposeFilterShouldPreventSend(RaygunMessage raygunMessage)
 {
     return FilterShouldPreventSend(raygunMessage);
 }
开发者ID:KennyBu,项目名称:raygun4net,代码行数:4,代码来源:FakeRaygunClient.cs


示例19: ExposeOnSendingMessage

 public bool ExposeOnSendingMessage(RaygunMessage raygunMessage)
 {
   return OnSendingMessage(raygunMessage);
 }
开发者ID:ArturDorochowicz,项目名称:raygun4net,代码行数:4,代码来源:FakeRaygunClient.cs


示例20: RaygunMessageBuilder

 private RaygunMessageBuilder()
 {
     _raygunMessage = new RaygunMessage();
 }
开发者ID:jesperll,项目名称:raygun4net,代码行数:4,代码来源:RaygunMessageBuilder.cs



注:本文中的Mindscape.Raygun4Net.Messages.RaygunMessage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Entities.MyEntity类代码示例发布时间:2022-05-26
下一篇:
C# Dream.XUri类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap