private void EnableOutputRedirect() { Console.OutputEncoding = Encoding.UTF8; var outputRedirect = new ConsoleRedirect(); outputRedirect.ProcessOutput = (outputLine) => { if (SystemLogger.Instance.IsLogEnabled) SystemLogger.Instance.WriteToLog(outputLine); }; Console.SetOut(outputRedirect); Console.SetError(outputRedirect); }
private void SetupLogging() { recentEventsLog = new TsList<LogEntry>(); Console.OutputEncoding = Encoding.UTF8; var outputRedirect = new ConsoleRedirect(); outputRedirect.ProcessOutput = (outputLine) => { LogBroadcastEvent(Domains.HomeGenie_System, "Console", "StdOut/StdErr redirect", "Console.Output", outputLine); }; Console.SetOut(outputRedirect); Console.SetError(outputRedirect); }