From 18b1f73025a4142a40c0242c1968879fb2d3450a Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 14 May 2025 15:01:21 +0200 Subject: [PATCH] Enables console output for test logs --- Tests/DistTestCore/Global.cs | 9 +++++++-- Tests/DistTestCore/Logs/BaseTestLog.cs | 18 +----------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Tests/DistTestCore/Global.cs b/Tests/DistTestCore/Global.cs index 4ba1374b..ddd7a5cc 100644 --- a/Tests/DistTestCore/Global.cs +++ b/Tests/DistTestCore/Global.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System.Diagnostics; +using System.Reflection; using Core; using Logging; @@ -33,7 +34,9 @@ namespace DistTestCore { try { - Stopwatch.Measure(log, "Global setup", () => + Trace.Listeners.Add(new ConsoleTraceListener()); + + Logging.Stopwatch.Measure(log, "Global setup", () => { globalEntryPoint.Announce(); globalEntryPoint.Tools.CreateWorkflow().DeleteNamespacesStartingWith(TestNamespacePrefix, wait: true); @@ -55,6 +58,8 @@ namespace DistTestCore deleteTrackedFiles: true, waitTillDone: true ); + + Trace.Flush(); } } } diff --git a/Tests/DistTestCore/Logs/BaseTestLog.cs b/Tests/DistTestCore/Logs/BaseTestLog.cs index e670e0c1..51775512 100644 --- a/Tests/DistTestCore/Logs/BaseTestLog.cs +++ b/Tests/DistTestCore/Logs/BaseTestLog.cs @@ -59,24 +59,8 @@ namespace DistTestCore.Logs protected static ILog CreateMainLog(string fullName, string name) { - ILog log = new FileLog(fullName); - log = ApplyConsoleOutput(log); - return log; - } - - private static ILog ApplyConsoleOutput(ILog log) - { - // If we're running as a release test, we'll split the log output - // to the console as well. - - var testType = Environment.GetEnvironmentVariable("TEST_TYPE"); - if (string.IsNullOrEmpty(testType) || testType.ToLowerInvariant() != "release-tests") - { - return log; - } - return new LogSplitter( - log, + new FileLog(fullName), new ConsoleLog() ); }