private void LogToLoggerClient (LogLevel level, string tag, string message, Exception exc) { if (level >= LogLevel.Warning) { ErrorSeverity severity; switch (level) { case LogLevel.Warning: severity = ErrorSeverity.Warning; break; case LogLevel.Error: severity = ErrorSeverity.Error; break; default: severity = ErrorSeverity.Info; break; } var md = new Metadata (); md.AddToTab ("Logger", "Tag", tag); md.AddToTab ("Logger", "Message", message); AddExtraMetadata (md); var loggerClient = ServiceContainer.Resolve<ILoggerClient> (); if (loggerClient != null) { loggerClient.Notify (exc, severity, md); } } }
protected override void AddExtraMetadata (Metadata md) { var settings = ServiceContainer.Resolve<SettingsStore> (); md.AddToTab ("State", "Experiment", settings.ExperimentId); md.AddToTab ("State", "Read duration only notice", settings.ReadDurOnlyNotice ? "Yes" : "No"); md.AddToTab ("Settings", "Show projects for new", settings.ChooseProjectForNew ? "Yes" : "No"); md.AddToTab ("Settings", "Add default tag", settings.UseDefaultTag ? "Yes" : "No"); }
protected override void AddExtraMetadata (Metadata md) { var settings = ServiceContainer.Resolve<SettingsStore> (); md.AddToTab ("State", "Experiment", settings.ExperimentId); md.AddToTab ("State", "Push registered", String.IsNullOrWhiteSpace (settings.GcmRegistrationId) ? "No" : "Yes"); md.AddToTab ("Settings", "Show projects for new", settings.ChooseProjectForNew ? "Yes" : "No"); md.AddToTab ("Settings", "Idle notifications", settings.IdleNotification ? "Yes" : "No"); md.AddToTab ("Settings", "Add default tag", settings.UseDefaultTag ? "Yes" : "No"); }
protected override void AddExtraMetadata (Metadata md) { var settings = ServiceContainer.Resolve<SettingsStore> (); md.AddToTab ("State", "Experiment", settings.ExperimentId); md.AddToTab ("State", "Push registered", String.IsNullOrWhiteSpace (settings.GcmRegistrationId) ? "No" : "Yes"); md.AddToTab ("State", "Got welcome message", settings.GotWelcomeMessage ? "Yes" : "No"); md.AddToTab ("State", "Read recent continue notice", settings.ReadContinueDialog ? "Yes" : "No"); md.AddToTab ("State", "Read duration only notice", settings.ReadDurOnlyNotice ? "Yes" : "No"); md.AddToTab ("Settings", "Show projects for new", settings.ChooseProjectForNew ? "Yes" : "No"); md.AddToTab ("Settings", "Idle notifications", settings.IdleNotification ? "Yes" : "No"); md.AddToTab ("Settings", "Add default tag", settings.UseDefaultTag ? "Yes" : "No"); }
public void Notify (Exception e, ErrorSeverity severity = ErrorSeverity.Error, Metadata extraMetadata = null) { #if (!DEBUG) var extraData = new Dictionary<string, string> (); foreach (var item in extraMetadata) { if (item.Value != null) { var data = item.Value.ToObject<Dictionary<string, string>>(); foreach (var i in data) { extraData.Add ( item.Key + ":" + i.Key, i.Value); } } } var tags = new List<string> { Enum.GetName (typeof (ErrorSeverity), severity) }; RaygunClient.Current.SendInBackground (e, tags, extraData); #endif }
public void Notify (Exception e, ErrorSeverity severity = ErrorSeverity.Error, Metadata extraMetadata = null) { var extraData = new Dictionary<string, string> (); foreach (var item in extraMetadata) { if (item.Value != null) { var data = item.Value.ToObject<Dictionary<string, string>>(); foreach (var i in data) { extraData.Add ( item.Key + ":" + i.Key, i.Value); } } } if (severity == ErrorSeverity.Info) { Insights.Track ("Info", extraData); } else { var reportSeverity = severity == ErrorSeverity.Warning ? Insights.Severity.Warning : Insights.Severity.Error; Insights.Report (e, extraData, reportSeverity); } }
protected abstract void AddExtraMetadata (Metadata md);
public Metadata (Metadata other) : base (other) { }
protected abstract void AddExtraMetadata(Metadata md);