Add colored console output to logging
Update `Log` to write messages to the console, using red for server exceptions and blue for other messages. Preserve thread-safe XML report logging and reorder `using` directives.
This commit is contained in:
+7
-3
@@ -1,7 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Linq;
|
||||
using ClientServerShared;
|
||||
using PipeMethodCalls;
|
||||
using ClientServerShared;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Linq;
|
||||
|
||||
// All output is written to an XML report next to the executable
|
||||
string reportPath = Path.Combine(AppContext.BaseDirectory, "ClientReport.xml");
|
||||
@@ -56,6 +56,10 @@ void Log(string message)
|
||||
{
|
||||
lock (report)
|
||||
report.Add(new XElement("Entry", new XAttribute("Time", DateTime.Now.ToString("O")), message));
|
||||
|
||||
Console.ForegroundColor = message.Contains("Server exception") ? ConsoleColor.Red : ConsoleColor.Blue;
|
||||
Console.WriteLine(message);
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
async Task BasicCallsExampleAsync()
|
||||
|
||||
Reference in New Issue
Block a user