public virtual IExceptionReportSender Clone() { IExceptionReportSender clone = CreateEmptyClone(); clone.CopyFrom(this); return(clone); }
void CheckReportToDevExpressFileNameSpecified(IExceptionReportSender rootSender) { const string apiKey = "12345678FEE1DEADBEEF4B1DBABEFACE"; const string serviceUrl = "https://logify.devexpress.com"; EmptyBackgroundExceptionReportSender root = rootSender as EmptyBackgroundExceptionReportSender; Assert.AreEqual(true, root != null); Assert.AreEqual(apiKey, root.ApiKey); Assert.AreEqual(serviceUrl, root.ServiceUrl); CompositeExceptionReportSender composite = root.InnerSender as CompositeExceptionReportSender; Assert.AreEqual(true, composite != null); Assert.AreEqual(apiKey, composite.ApiKey); Assert.AreEqual(serviceUrl, composite.ServiceUrl); ExternalProcessExceptionReportSender externalSender = composite.Senders[0] as ExternalProcessExceptionReportSender; Assert.AreEqual(true, externalSender != null); Assert.AreEqual(apiKey, externalSender.ApiKey); Assert.AreEqual(serviceUrl, externalSender.ServiceUrl); WinFormsExceptionReportSender winFormsSender = composite.Senders[1] as WinFormsExceptionReportSender; Assert.AreEqual(true, winFormsSender != null); Assert.AreEqual(apiKey, winFormsSender.ApiKey); Assert.AreEqual(serviceUrl, winFormsSender.ServiceUrl); //FileExceptionReportSender file = composite.Senders[2] as FileExceptionReportSender; //Assert.AreEqual(true, file != null); //Assert.AreEqual(apiKey, file.ApiKey); //Assert.AreEqual(serviceUrl, file.ServiceUrl); //Assert.AreEqual("exception.log", file.FileName); }
static void CheckSenderConsistency(LogifyClientBase client, IExceptionReportSender sender) { //Assert.AreEqual(client.MiniDumpServiceUrl, sender.MiniDumpServiceUrl); Assert.AreEqual(client.ServiceUrl, sender.ServiceUrl); Assert.AreEqual(client.ConfirmSendReport, sender.ConfirmSendReport); Assert.AreEqual(client.ApiKey, sender.ApiKey); }
void ApplyRecursively <TSender>(IExceptionReportSender sender, Action <TSender> action) where TSender : class { if (sender == null) { return; } TSender typedSender = sender as TSender; if (typedSender != null) { action(typedSender); } IExceptionReportSenderWrapper wrapper = sender as IExceptionReportSenderWrapper; if (wrapper != null) { ApplyRecursively <TSender>(wrapper.InnerSender, action); } CompositeExceptionReportSender composite = sender as CompositeExceptionReportSender; if (composite != null) { if (composite.Senders != null && composite.Senders.Count > 0) { int count = composite.Senders.Count; for (int i = 0; i < count; i++) { ApplyRecursively <TSender>(composite.Senders[i], action); } } } }
static void CheckDefaultStructureAndPredicate(LogifyAlert client, Predicate <IExceptionReportSender> predicate) { IExceptionReportSender sender = ExceptionLoggerFactory.Instance.PlatformReportSender; Assert.AreEqual(true, sender != null); Assert.AreEqual(typeof(EmptyBackgroundExceptionReportSender), sender.GetType()); CheckSenderConsistency(client, sender); predicate(sender); sender = ((EmptyBackgroundExceptionReportSender)sender).InnerSender; Assert.AreEqual(true, sender != null); Assert.AreEqual(typeof(CompositeExceptionReportSender), sender.GetType()); CheckSenderConsistency(client, sender); predicate(sender); CompositeExceptionReportSender compositeSender = (CompositeExceptionReportSender)sender; CheckSenderConsistency(client, compositeSender); predicate(compositeSender); Assert.AreEqual(true, compositeSender.Senders != null); Assert.AreEqual(2, compositeSender.Senders.Count); sender = compositeSender.Senders[0]; Assert.AreEqual(true, sender != null); Assert.AreEqual(typeof(WebExceptionReportSender), sender.GetType()); CheckSenderConsistency(client, sender); predicate(sender); sender = compositeSender.Senders[1]; Assert.AreEqual(true, sender != null); Assert.AreEqual(typeof(OfflineDirectoryExceptionReportSender), sender.GetType()); CheckSenderConsistency(client, sender); predicate(sender); }
public void SendOfflineReports() { try { if (!OfflineReportsEnabled) { return; } IExceptionReportSender innerSender = CreateConfiguredPlatformExceptionReportSender(); if (innerSender == null) { return; } innerSender.ConfirmSendReport = false; // innerSender.ProxyCredentials = this.proxyCredentials; //#if NETSTANDARD // innerSender.Proxy = this.Proxy; //#endif // innerSender.ApiKey = this.ApiKey; // innerSender.ServiceUrl = this.ServiceUrl; //innerSender.MiniDumpServiceUrl = this.MiniDumpServiceUrl; ISavedReportSender savedReportsSender = CreateSavedReportsSender(); if (savedReportsSender == null) { return; } savedReportsSender.Sender = innerSender; savedReportsSender.DirectoryName = this.OfflineReportsDirectory; savedReportsSender.TrySendOfflineReports(); } catch { } }
//const string serviceInfo = "/RW+Wzq8wasJP6LuHZcAbT2ShAvheOdnptsr/RI8zeCCfF6a+zXeWOhG0STFbxoLDjpzWj49DMTp0KZXufp4gz45nsSUwhcnrJC280vWliI="; protected void ReportToDevExpressCore(string uniqueUserId, string lastExceptionReportFileName, Assembly asm, IDictionary <string, string> customData) { IExceptionReportSender sender = ExceptionLoggerFactory.Instance.PlatformReportSender; if (sender != null && sender.CanSendExceptionReport()) { return; } IExceptionReportSender reportSender = CreateExceptionReportSender(); CompositeExceptionReportSender compositeSender = reportSender as CompositeExceptionReportSender; if (compositeSender == null) { compositeSender = new CompositeExceptionReportSender(); compositeSender.Senders.Add(reportSender); } /*if (!String.IsNullOrEmpty(lastExceptionReportFileName)) { * FileExceptionReportSender fileSender = new FileExceptionReportSender(); * fileSender.FileName = lastExceptionReportFileName; * compositeSender.Senders.Add(fileSender); * }*/ string[] info = GetServiceInfo(asm); if (info != null && info.Length == 2) { this.ServiceUrl = info[0]; // "http://logify.devexpress.com"; this.ApiKey = info[1]; // "12345678FEE1DEADBEEF4B1DBABEFACE"; //if (this.ServiceUrl.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase)) { if (CultureInfo.InvariantCulture.CompareInfo.IsPrefix(this.ServiceUrl, "http://", CompareOptions.IgnoreCase)) { this.ServiceUrl = "https://" + this.ServiceUrl.Substring("http://".Length); } } //this.MiniDumpServiceUrl = "http://logifydump.devexpress.com/"; compositeSender.ServiceUrl = this.ServiceUrl; //compositeSender.ApiKey = "dx$" + logId; compositeSender.ApiKey = this.ApiKey; //compositeSender.MiniDumpServiceUrl = this.MiniDumpServiceUrl; this.AppName = "DevExpress Demo or Design Time"; this.AppVersion = DetectDevExpressVersion(asm); this.UserId = uniqueUserId; this.ConfirmSendReport = false; this.CollectBreadcrumbsCore = false; if (customData != null) { this.customData = customData; } //TODO: Config.CollectMiniDump = true; //apply values to config ExceptionLoggerFactory.Instance.PlatformReportSender = CreateBackgroundExceptionReportSender(compositeSender); }
protected override bool SendExceptionReportInBackground(IExceptionReportSender innerSender, LogifyClientExceptionReport report) { if (innerSender != null) { return(innerSender.SendExceptionReport(report)); } else { return(false); } }
protected override async Task <bool> SendExceptionReportInBackgroundAsync(IExceptionReportSender innerSender, LogifyClientExceptionReport report) { if (innerSender != null) { return(await innerSender.SendExceptionReportAsync(report)); } else { return(false); } }
public virtual void CopyFrom(IExceptionReportSender instance) { this.ServiceUrl = instance.ServiceUrl; this.ApiKey = instance.ApiKey; this.ConfirmSendReport = instance.ConfirmSendReport; this.ProxyCredentials = instance.ProxyCredentials; #if NETSTANDARD this.Proxy = instance.Proxy; #endif //this.MiniDumpServiceUrl = instance.MiniDumpServiceUrl; //this.LogId = instance.LogId; }
protected IExceptionReportSender CreateConfiguredPlatformExceptionReportSender() { IExceptionReportSender result = CreateEmptyPlatformExceptionReportSender(); result.ConfirmSendReport = ConfirmSendReport; result.ProxyCredentials = ProxyCredentials; #if NETSTANDARD result.Proxy = this.Proxy; #endif result.ApiKey = this.ApiKey; result.ServiceUrl = this.ServiceUrl; return(result); }
public override void CopyFrom(IExceptionReportSender instance) { base.CopyFrom(instance); FileExceptionReportSender other = instance as FileExceptionReportSender; if (other == null) { return; } this.FileName = other.FileName; this.Append = other.Append; this.Encoding = other.Encoding; }
protected override Task <bool> SendExceptionReportInBackgroundAsync(IExceptionReportSender innerSender, LogifyClientExceptionReport report) { Thread thread = new Thread(() => { if (innerSender != null) { innerSender.SendExceptionReport(report); } }); //thread.Priority = ThreadPriority.Highest; thread.Start(); //Thread.Sleep(3000); return(Task.FromResult(true)); }
public override void CopyFrom(IExceptionReportSender instance) { base.CopyFrom(instance); OfflineDirectoryExceptionReportSender other = instance as OfflineDirectoryExceptionReportSender; if (other == null) { return; } this.DirectoryName = other.DirectoryName; this.Encoding = other.Encoding; this.ReportCount = other.ReportCount; this.IsEnabled = other.IsEnabled; }
protected override IExceptionReportSender CreateExceptionReportSender() { IExceptionReportSender defaultSender = CreateConfiguredPlatformExceptionReportSender(); if (ConfirmSendReport) { return(defaultSender); } CompositeExceptionReportSender sender = new CompositeExceptionReportSender(); sender.StopWhenFirstSuccess = true; //sender.Senders.Add(new ExternalProcessExceptionReportSender()); sender.Senders.Add(defaultSender); sender.Senders.Add(new OfflineDirectoryExceptionReportSender()); return(sender); }
LogifyAlertRemoteConfiguration GetRemoteConfiguration() { IExceptionReportSender sender = CreateEmptyPlatformExceptionReportSender(); if (sender == null) { return(null); } IRemoteConfigurationProvider provider = sender as IRemoteConfigurationProvider; if (provider == null) { return(null); } return(provider.GetConfiguration(this.ServiceUrl, this.ApiKey)); }
protected internal void InitAfterConfigure() { IExceptionReportSender reportSender = CreateExceptionReportSender(); reportSender.ServiceUrl = this.ServiceUrl; reportSender.ApiKey = this.ApiKey; reportSender.ConfirmSendReport = this.ConfirmSendReport; reportSender.ProxyCredentials = this.ProxyCredentials; #if NETSTANDARD reportSender.Proxy = this.Proxy; #endif //reportSender.MiniDumpServiceUrl = this.MiniDumpServiceUrl; ApplyRecursively <IOfflineDirectoryExceptionReportSender>(reportSender, (s) => { s.IsEnabled = this.OfflineReportsEnabled; }); ApplyRecursively <IOfflineDirectoryExceptionReportSender>(reportSender, (s) => { s.DirectoryName = this.OfflineReportsDirectory; }); ApplyRecursively <IOfflineDirectoryExceptionReportSender>(reportSender, (s) => { s.ReportCount = this.OfflineReportsCount; }); ExceptionLoggerFactory.Instance.PlatformReportSender = CreateBackgroundExceptionReportSender(reportSender); //ExceptionLoggerFactory.Instance.PlatformIgnoreDetection = CreateIgnoreDetection(); }
public override void CopyFrom(IExceptionReportSender instance) { base.CopyFrom(instance); CompositeExceptionReportSender other = instance as CompositeExceptionReportSender; if (other == null) { return; } for (int i = 0; i < other.Senders.Count; i++) { this.Senders.Add(other.Senders[i].Clone()); } this.StopWhenFirstSuccess = other.StopWhenFirstSuccess; }
internal static async Task <bool> ReportExceptionAsync(Exception ex, IInfoCollector collector) { IExceptionReportSender reportSender = ExceptionLoggerFactory.Instance.PlatformReportSender; if (reportSender == null) { return(false); } if (collector == null) { return(false); } reportSender = reportSender.Clone(); ExceptionLogger logger = new ExceptionLogger(); logger.ReportSender = reportSender; return(await logger.PerformReportExceptionAsync(ex, collector)); }
public BackgroundThreadExceptionReportSender(IExceptionReportSender innerSender) : base(innerSender) { }
protected BackgroundExceptionReportSender(IExceptionReportSender innerSender) { this.innerSender = innerSender; }
public EmptyBackgroundExceptionReportSender(IExceptionReportSender innerSender) : base(innerSender) { }
protected abstract Task <bool> SendExceptionReportInBackgroundAsync(IExceptionReportSender innerSender, LogifyClientExceptionReport report);
protected abstract bool SendExceptionReportInBackground(IExceptionReportSender innerSender, LogifyClientExceptionReport report);
protected virtual BackgroundExceptionReportSender CreateBackgroundExceptionReportSender(IExceptionReportSender reportSender) { return(new EmptyBackgroundExceptionReportSender(reportSender)); }