public void R(string text, VerbositySettings verbosity = Moderate, [CallerFilePath] string path = "", [CallerMemberName] string caller = "", [CallerLineNumber] int line = 0) { if (verbosity <= Verbosity) // Only write if verbosity is below threshold. { var strippedText = Regex.Replace(text, @"\n", ""); // Strip out any new lines. var message = new Message("(Reporter):", DateTime.Now, strippedText, path, caller, line); // Construct message. int newMessageIndex = Report.Messages.Count; // New message index will equal count. Report.AddMessage(message); ReportWriter.WriteMessage(newMessageIndex); } }
/// <summary>Initialize AppReporter as set to write to console and file.</summary> public Reporter(IO.FConsole writer, VerbositySettings verbosity = VerbositySettings.Moderate, [CallerFilePath] string path = "", [CallerMemberName] string caller = "", [CallerLineNumber] int line = 0) { Output = new OutputSettings(); Output |= (OutputSettings.Console | OutputSettings.File); Verbosity = verbosity; StartTime = DateTime.Now; _Report = new Report(StartTime); ReportWriter = new ReportWriter(this, writer); // var initMessage = new Message(StartTime, initMsg, path, caller, line); // Write initial message. // Report.AddMessage(initMessage); // ReportWriter.WriteMessage(0); // Write initial message (Program started, etc.) }
public static void R(string s, VerbositySettings verbosity = VerbositySettings.Moderate) => T.Reporter.R(s, verbosity);