private void btnAudit_Click(object sender, EventArgs e) { ErrorReporter.ReportAudit("Random Audit 1").ContinueWith((task) => { Console.WriteLine(task.Result.IncidentCode); }); lblAuditIC.Text = "fire and forget"; }
public ActionResult Trace(string message, string messageType) { if (messageType.ToLower() == "trace") { ErrorReporter.ReportTrace(message); ViewBag.Message = "Trace message stored."; } else if (messageType.ToLower() == "warning") { ErrorReporter.ReportWarning(message); ViewBag.Message = "Warning message stored."; } else if (messageType.ToLower() == "audit") { ErrorReporter.ReportAudit(message); ViewBag.Message = "Audit message stored."; } return(View("Index")); }
public async Task TestCode() { var context = new ApplicationContext(strClientID: "Organization ID/Name", strUserType: "UserType", strUserID: "UserID"); await ErrorReporter.ReportError("Error 1", context, intSeverity : 8, intDuration : 1234); await ErrorReporter.ReportError("Error 2"); await ErrorReporter.ReportAudit("Audit 1", context, strDetails : "This is what happened in detail", intDuration : 3333); await ErrorReporter.ReportAudit("Audit 2"); await ErrorReporter.ReportTrace("Trace 1", context, strDetails : "Details", strMethodName : System.Reflection.MethodBase.GetCurrentMethod().Name, intDuration : 2222); await ErrorReporter.ReportTrace("Trace 2"); await ErrorReporter.ReportWarning("Warning 1", context, strDetails : "A file couldn't be loaded, restoring from cache", strFileName : "File.jpg", intDuration : 1111); await ErrorReporter.ReportWarning("Warning 2"); }
public async Task TestAudit() { ApplicationContext context = new ApplicationContext(); context.ClientID = "client4"; context.Custom1 = "cus1"; context.Custom2 = "cus2"; context.Custom3 = "cus3"; context.CustomID = 9876; context.UserID = "user4"; context.UserType = "utype4"; var response = await ErrorReporter.ReportAudit("audit unit test", context); Assert.IsNotNull(response); Assert.IsTrue(response.Success); Assert.IsFalse((String.IsNullOrWhiteSpace(response.IncidentCode) || response.IncidentCode == "0") && !response.Message.Contains("unknown")); var response2 = await ErrorReporter.ReportAudit("audit unit test 2", context, intSeverity : 97, strDetails : "audit detail text", strMethodName : "MyMethod", strFileName : "MyFile.test"); Assert.IsNotNull(response2); Assert.IsTrue(response2.Success); Assert.IsFalse((String.IsNullOrWhiteSpace(response2.IncidentCode) || response2.IncidentCode == "0") && !response2.Message.Contains("unknown")); }