mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 08:17:53 +01:00
WIP: submitting #4429
This commit is contained in:
@@ -9,6 +9,12 @@
|
||||
<Version>2.0</Version>
|
||||
<InformationalVersion>2.0</InformationalVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" />
|
||||
<PackageReference Include="Serilog.Sinks.File" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,16 +1,34 @@
|
||||
#nullable enable
|
||||
// Example Runner - Demonstrates discovering and running all examples using the example infrastructure
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
using Terminal.Gui.App;
|
||||
using Terminal.Gui.Configuration;
|
||||
using Terminal.Gui.Examples;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
|
||||
[assembly: ExampleMetadata ("Example Runner", "Discovers and runs all examples sequentially")]
|
||||
[assembly: ExampleCategory ("Infrastructure")]
|
||||
// Configure Serilog to write to Debug output and Console
|
||||
Log.Logger = new LoggerConfiguration ()
|
||||
.MinimumLevel.Is (LogEventLevel.Verbose)
|
||||
.WriteTo.Debug ()
|
||||
.CreateLogger ();
|
||||
|
||||
ILogger logger = LoggerFactory.Create (builder =>
|
||||
{
|
||||
builder
|
||||
.AddSerilog (dispose: true) // Integrate Serilog with ILogger
|
||||
.SetMinimumLevel (LogLevel.Trace); // Set minimum log level
|
||||
}).CreateLogger ("ExampleRunner Logging");
|
||||
Logging.Logger = logger;
|
||||
|
||||
Logging.Debug ("Logging enabled - writing to Debug output\n");
|
||||
|
||||
// Parse command line arguments
|
||||
bool useFakeDriver = args.Contains ("--fake-driver") || args.Contains ("-f");
|
||||
int timeout = 5000; // Default timeout in milliseconds
|
||||
int timeout = 30000; // Default timeout in milliseconds
|
||||
|
||||
for (var i = 0; i < args.Length; i++)
|
||||
{
|
||||
@@ -131,4 +149,7 @@ if (useFakeDriver)
|
||||
Console.WriteLine ("\nNote: Tests run with FakeDriver. Some examples may timeout if they don't respond to Esc key.");
|
||||
}
|
||||
|
||||
// Flush logs before exiting
|
||||
Log.CloseAndFlush ();
|
||||
|
||||
return failCount == 0 ? 0 : 1;
|
||||
|
||||
Reference in New Issue
Block a user