Ejemplo n.º 1
0
 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"));
 }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reports the parsing warnings. Only works if the
        /// parser is running internally.
        /// </summary>
        private void ReportParsingWarnings()
        {
            if (!base.Options.ExitOnError || !ErrorReporter.ShowWarnings)
            {
                return;
            }

            foreach (var warning in this.WarningLog)
            {
                var report      = warning.Item2;
                var warningLine = base.SyntaxTree.GetLineSpan(warning.Item1.Span).StartLinePosition.Line + 1;

                var root  = base.SyntaxTree.GetRoot();
                var lines = System.Text.RegularExpressions.Regex.Split(root.ToFullString(), "\r\n|\r|\n");

                report += "\nIn " + this.SyntaxTree.FilePath + " (line " + warningLine + "):\n";
                report += " " + lines[warningLine - 1];

                ErrorReporter.ReportWarning(report);
            }

            IO.PrettyPrintLine("Found {0} parsing warning{1}.", this.WarningLog.Count,
                               this.WarningLog.Count == 1 ? "" : "s");
        }
Ejemplo n.º 4
0
 public void ReportWarning_NullNode_ThrowsException()
 {
     Assert.Throws <ArgumentNullException>(() => _errorReporter.ReportWarning(null, "Test warning"));
 }