public static void DemoLogicalErrors() { Err.ReportLogicError("User skipped step Starting", new { user = "******" }, "SkipStepStarting"); Err.ReportLogicError("This failed", new { id = 10 }, "MixMax2"); Err.ReportLogicError("Network dropped packets", new { destination = "chat.host.com", packet = new { FromNick = "jonas", ToNick = "arne", message = "Hello world" } }); }
public async Task HandleAsync(IMessageContext context, ReportAddedToIncident e) { string version = null; foreach (var contextCollection in e.Report.ContextCollections) { if (contextCollection.Properties.TryGetValue(AppAssemblyVersion, out version)) { break; } } if (version == null) { return; } version = CleanVersionFromUnwantedCharacters(version); if (version.Length > 20) { Err.ReportLogicError("Application version is too large.", new { version, e.Incident.ApplicationName }, "AppVersionLength"); return; } var isNewIncident = e.Incident.ReportCount <= 1; var versionEntity = await _repository.FindVersionAsync(e.Incident.ApplicationId, version) ?? new ApplicationVersion(e.Incident.ApplicationId, e.Incident.ApplicationName, version); if (versionEntity.Version != version) { versionEntity = new ApplicationVersion(e.Incident.ApplicationId, e.Incident.ApplicationName, version); } versionEntity.UpdateReportDate(); if (versionEntity.Id == 0) { await _repository.CreateAsync(versionEntity); } else { await _repository.UpdateAsync(versionEntity); } _repository.SaveIncidentVersion(e.Incident.Id, versionEntity.Id); await IncreaseReportCounter(versionEntity.Id, isNewIncident, e.Report.CreatedAtUtc); }
static void Main(string[] args) { var url = new Uri("http://localhost:50473/"); Err.Configuration.Credentials(url, "ae0428b701054c5d9481024f81ad8b05", "988cedd2bf4641d1aa228766450fab97"); Err.ReportLogicError("User should have been assigned."); try { throw new NotSupportedException("Not invented here"); } catch (Exception ex) { Err.Report(ex, new { myData = "hello", ErrTags = "important" }); } Console.WriteLine("Hello World!"); }
static void Main() { var log = CreateLogger(); log.Info("Starting application"); var url = new Uri("http://*****:*****@gauffin.com", "This is what I did: NOTHING!"); } return; Err.ReportLogicError("User should have been assigned.", errorId: "MainN"); ThrowImportantError(); Console.WriteLine("Hello World!"); }