/// <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)
        {
            try
            {
                bool canSend = OnSendingMessage(raygunMessage) && CanSend(raygunMessage);
                if (canSend)
                {
                    var message = SimpleJson.SerializeObject(raygunMessage);
                    WebClientHelper.Send(message, _apiKey, ProxyCredentials);
                }
            }
            catch (Exception ex)
            {
                try
                {
                    System.Diagnostics.Trace.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message));
                }
                catch
                {
                    // ignored
                }

                if (RaygunSettings.Settings.ThrowOnError)
                {
                    throw;
                }
            }
        }
Ejemplo n.º 2
0
        private void Send(string message)
        {
            RaygunLogger.Instance.Verbose("Sending Payload --------------");
            RaygunLogger.Instance.Verbose(message);
            RaygunLogger.Instance.Verbose("------------------------------");

            WebClientHelper.Send(message, _apiKey, ProxyCredentials);
        }