Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
        /// <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.)
        }
Exemplo n.º 3
0
 /// <summary>Write a string to report outputs, without any special formatting.</summary>
 /// <param name="s">String to write.</param>
 public void WriteLine(string s = "") => ReportWriter.WriteLine(s);