public override bool Read(GH_IO.Serialization.GH_IReader reader) { // Make it really obvious when running from develop by adding a tag to the component itself #if DEBUG this.Message = getNiceGroundHogVersion().ToString() + " dev"; #endif #if !DEBUG if (Globals.Logged == false) { // Basic logging of component type var logMessage = "USED: " + base.Name; var sentryEvent = new SharpRaven.Data.SentryEvent(logMessage) { Level = SharpRaven.Data.ErrorLevel.Info }; constructRavenClient().Capture(sentryEvent); // Set logging global Globals.Logged = true; } #endif return(base.Read(reader)); }
internal static void ReportAsync(SentryEvent @event) { Task.Factory.StartNew(() => { try { Report(@event); } catch { } }); }
public static string CaptureException(Exception ex) { var plugins = PluginManager.Instance.Plugins.Where(x => x.IsEnabled).ToList(); ex.Data.Add("active-plugins", plugins.Any() ? string.Join(", ", plugins.Select(x => x.NameAndVersion)) : "none"); var exception = new SentryEvent(ex); #if(SQUIRREL) exception.Tags.Add("squirrel", "true"); #else exception.Tags.Add("squirrel", "false"); #endif return Client.Capture(exception); }
public static ErrorReporterEvent PrepareEventToSend(Exception ex, AppSettings appSettings, string ivpnLog, string ivpnLogOld, string vpnProtocolLog, string vpnProtocolLogOld, bool?isServiceError = null) { if (ex == null) { return(null); } IDictionary <string, string> parameters = InitializeParameters(appSettings); foreach (var item in parameters) { ex.Data.Add(item.Key, item.Value); } if (!string.IsNullOrEmpty(ivpnLog)) { ex.Data.Add(GetFieldName(FieldsPositions.ivpnLog), ivpnLog); } if (!string.IsNullOrEmpty(ivpnLogOld)) { ex.Data.Add(GetFieldName(FieldsPositions.ivpnLogOld), ivpnLogOld); } if (!string.IsNullOrEmpty(vpnProtocolLog)) { ex.Data.Add(GetFieldName(FieldsPositions.vpnProtocolLog), vpnProtocolLog); } if (!string.IsNullOrEmpty(vpnProtocolLogOld)) { ex.Data.Add(GetFieldName(FieldsPositions.vpnProtocolLogOld), vpnProtocolLogOld); } var logEvt = new SharpRaven.Data.SentryEvent(ex); logEvt.Tags = InitializeTags(appSettings); if (isServiceError != null) { ex.Data.Add(GetFieldName(FieldsPositions.IsService), ((bool)isServiceError).ToString()); logEvt.Tags.Add($"{FieldsPositions.IsService}", isServiceError.ToString()); } logEvt.Message = ex.Message; logEvt.Contexts.Device.Name = ""; // do not send real device name ErrorReporterEvent ret = new ErrorReporterEvent(logEvt); //DivideBigParameters(ret); return(ret); }
internal static void Report(SentryEvent @event) { #if !DEBUG try { @event.Tags.Add("Arch", Environment.Is64BitOperatingSystem ? "x64" : "x86"); @event.Tags.Add("OS", Environment.OSVersion.VersionString); @event.Tags.Add("CLR", Environment.Version.ToString()); ravenClient.Capture(@event); } catch { } #endif }
/// <summary>Initializes a new instance of the <see cref="JsonPacket"/> class.</summary> /// <param name="project">The project.</param> /// <param name="event">The event.</param> public JsonPacket(string project, SentryEvent @event) : this(project) { if (@event == null) throw new ArgumentNullException("event"); if (@event.Exception != null) Initialize(@event.Exception); Message = @event.Message != null ? @event.Message.ToString() : null; Level = @event.Level; Extra = Merge(@event); Tags = @event.Tags; Fingerprint = @event.Fingerprint.ToArray(); MessageObject = @event.Message; }
public JsonPacket Create(string project, SentryMessage message, ErrorLevel level = ErrorLevel.Info, IDictionary<string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(message) { Level = level, Extra = extra, Tags = tags, Fingerprint = fingerprint }; return Create(project, @event); }
/// <summary>Initializes a new instance of the <see cref="JsonPacket"/> class.</summary> /// <param name="project">The project.</param> /// <param name="event">The event.</param> public JsonPacket(string project, SentryEvent @event) : this(project) { if (@event == null) { throw new ArgumentNullException("event"); } if (@event.Exception != null) { Initialize(@event.Exception); } Message = @event.Message != null? @event.Message.ToString() : null; MessageObject = @event.Message; }
public JsonPacket Create(string project, SentryMessage message, ErrorLevel level = ErrorLevel.Info, IDictionary <string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(message) { Level = level, Extra = extra, Tags = tags, Fingerprint = fingerprint }; return(Create(project, @event)); }
public JsonPacket Create(string project, Exception exception, SentryMessage message = null, ErrorLevel level = ErrorLevel.Error, IDictionary <string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(exception) { Message = message, Level = level, Extra = extra, Tags = tags, Fingerprint = fingerprint, }; return(Create(project, @event)); }
/// <summary>Initializes a new instance of the <see cref="JsonPacket"/> class.</summary> /// <param name="project">The project.</param> /// <param name="event">The event.</param> public JsonPacket(string project, SentryEvent @event) : this(project) { if (@event == null) { throw new ArgumentNullException("event"); } if (@event.Exception != null) { Initialize(@event.Exception); } Message = @event.Message != null? @event.Message.ToString() : null; Level = @event.Level; Extra = Merge(@event); Tags = @event.Tags; Fingerprint = @event.Fingerprint.ToArray(); MessageObject = @event.Message; }
internal static void ReportAsync(Exception exception, object extra) { var @event = new SentryEvent(exception); @event.Extra = extra; ReportAsync(@event); }
private static object Merge(SentryEvent @event) { var exception = @event.Exception; var extra = @event.Extra; if (exception == null && extra == null) return null; if (extra != null && exception == null) return extra; var exceptionData = new ExceptionData(exception); if (extra == null) return exceptionData; JObject result; if (extra.GetType().IsArray) { result = new JObject(); var array = JArray.FromObject(extra); foreach (var o in array) { var jo = o as JObject; JProperty[] properties; if (jo == null || (properties = jo.Properties().ToArray()).Length != 2 || properties[0].Name != "Key" || properties[1].Name != "Value") { result.Merge(o); continue; } var key = properties[0].Value.ToString(); var value = properties[1].Value; result.Add(key, value); } } else result = JObject.FromObject(extra); var jExceptionData = JObject.FromObject(exceptionData); result.Merge(jExceptionData); return result; }
public string CaptureMessage(SentryMessage message, ErrorLevel level = ErrorLevel.Info, IDictionary<string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(message) { Level = level, Extra = extra, Tags = MergeTags(tags), Fingerprint = fingerprint }; return Capture(@event); }
public string CaptureException(Exception exception, SentryMessage message = null, ErrorLevel level = ErrorLevel.Error, IDictionary<string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(exception) { Message = message, Level = level, Extra = extra, Tags = MergeTags(tags), Fingerprint = fingerprint }; return Capture(@event); }
/// <summary>Captures the specified <paramref name="event"/>.</summary> /// <param name="event">The event to capture.</param> /// <returns> /// The <see cref="JsonPacket.EventID" /> of the successfully captured <paramref name="event" />, or <c>null</c> if it fails. /// </returns> public string Capture(SentryEvent @event) { if (@event == null) throw new ArgumentNullException("event"); @event.Tags = MergeTags(@event.Tags); var packet = this.jsonPacketFactory.Create(CurrentDsn.ProjectID, @event); return Send(packet); }
/// <summary>Captures the event.</summary> /// <param name="event">The event.</param> /// <returns> /// The <see cref="JsonPacket.EventID" /> of the successfully captured <paramref name="exception" />, or <c>null</c> if it fails. /// </returns> public async Task<string> CaptureAsync(SentryEvent @event) { @event.Tags = MergeTags(@event.Tags); var packet = this.jsonPacketFactory.Create(CurrentDsn.ProjectID, @event); return await SendAsync(packet); }
/// <summary> /// Creates a new instance of <see cref="JsonPacket" /> for the specified /// <paramref name="project" />, with the given <paramref name="event" />. /// </summary> /// <param name="project">The project.</param> /// <param name="event">The event to capture.</param> /// <returns> /// A new instance of <see cref="JsonPacket" /> for the specified /// <paramref name="project" />, with the given <paramref name="event" />. /// </returns> public JsonPacket Create(string project, SentryEvent @event) { var json = new JsonPacket(project, @event); return(OnCreate(json)); }
public static void CaptureEvent(SentryEvent e) { Client.Capture(e); }
internal static void ReportAsync(string message, ErrorLevel level = ErrorLevel.Debug) { var @event = new SentryEvent(new SentryMessage(message)); @event.Level = level; ReportAsync(@event); }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { var exception = e.ExceptionObject as Exception; MessageBox.Show(string.Format("알 수 없는 오류가 발생해 프로그램을 종료합니다.\n\n에러: {0}", exception.Message), "에러 발생", MessageBoxButtons.OK, MessageBoxIcon.Error); var @event = new SentryEvent(exception); @event.Level = ErrorLevel.Fatal; Report(@event); } catch { } }
/// <summary> /// Creates a new instance of <see cref="JsonPacket" /> for the specified /// <paramref name="project" />, with the given <paramref name="event" />. /// </summary> /// <param name="project">The project.</param> /// <param name="event">The event to capture.</param> /// <returns> /// A new instance of <see cref="JsonPacket" /> for the specified /// <paramref name="project" />, with the given <paramref name="event" />. /// </returns> public JsonPacket Create(string project, SentryEvent @event) { var json = new JsonPacket(project, @event); return OnCreate(json); }
public async Task<string> CaptureMessageAsync(SentryMessage message, ErrorLevel level = ErrorLevel.Info, IDictionary<string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(message) { Level = level, Extra = extra, Tags = tags, Fingerprint = fingerprint }; return await CaptureAsync(@event); }
public JsonPacket Create(string project, Exception exception, SentryMessage message = null, ErrorLevel level = ErrorLevel.Error, IDictionary<string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(exception) { Message = message, Level = level, Extra = extra, Tags = tags, Fingerprint = fingerprint, }; return Create(project, @event); }
public async Task<string> CaptureExceptionAsync(Exception exception, SentryMessage message = null, ErrorLevel level = ErrorLevel.Error, IDictionary<string, string> tags = null, string[] fingerprint = null, object extra = null) { var @event = new SentryEvent(exception) { Message = message, Level = level, Extra = extra, Tags = tags, Fingerprint = fingerprint }; return await CaptureAsync(@event); }
private static object Merge(SentryEvent @event) { var exception = @event.Exception; var extra = @event.Extra; if (exception == null && extra == null) { return(null); } if (extra != null && exception == null) { return(extra); } var exceptionData = new ExceptionData(exception); if (extra == null) { return(exceptionData); } JObject result; if (extra.GetType().IsArray) { result = new JObject(); var array = JArray.FromObject(extra); foreach (var o in array) { var jo = o as JObject; JProperty[] properties; if (jo == null || (properties = jo.Properties().ToArray()).Length != 2 || properties[0].Name != "Key" || properties[1].Name != "Value") { result.Merge(o); continue; } var key = properties[0].Value.ToString(); var value = properties[1].Value; result.Add(key, value); } } else { try { result = JObject.FromObject(extra); } catch (ArgumentException) { result = JObject.FromObject(new Dictionary <string, object> { { extra.GetType().ToString(), extra } }); } } var jExceptionData = JObject.FromObject(exceptionData); result.Merge(jExceptionData); return(result); }
internal static void Report(string message) { var @event = new SentryEvent(new SentryMessage(message)); @event.Level = ErrorLevel.Debug; Report(@event); }