stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.79k stars 188 forks source link

Change default color of console output #3046

Open draptik opened 1 month ago

draptik commented 1 month ago

The default color of the console output is difficult to read when using a console with light background. A similar issue was raised in the past: https://github.com/stryker-mutator/stryker-net/issues/1602

Describe the solution you'd like The above ticket mentions that Stryker uses Serilog.Sinks.Console for generating the output. Serilog provides an easy way to change the color theme: https://github.com/serilog/serilog-sinks-console?tab=readme-ov-file#themes

Describe alternatives you've considered

This seems to be the relevant part in the current code, if I'm not mistaking: https://github.com/stryker-mutator/stryker-net/blob/567f028dc28fb180fd1e877a6e9992679da90935/src/Stryker.CLI/Stryker.CLI/Logging/ApplicationLogging.cs#L17

Additional context 20240926-113216-swappy 20240926-113329-swappy 20240926-113501-swappy 20240926-113537-swappy

using Serilog;
using Serilog.Sinks.SystemConsole.Themes;

namespace ConsoleApp1;

public static class Program
{
    public static void Main(string[] _)
    {
        // For details see https://github.com/serilog/serilog-sinks-console?tab=readme-ov-file#themes
        //var defaultTheme = AnsiConsoleTheme.Literate;
        //var selectedTheme = defaultTheme;
        var selectedTheme = AnsiConsoleTheme.Sixteen;

        Log.Logger = new LoggerConfiguration()
            .WriteTo.Console(theme: selectedTheme)
            .CreateLogger();

        Log.Information("Hello World!");
    }
}

What do you think?

rouke-broersma commented 1 month ago

Sounds good to me

bhargava-raju commented 1 month ago

I want to work on this ticket, can you assign this to me

rouke-broersma commented 1 month ago

@bhargava-raju please check the concerns on the existing PR here: https://github.com/stryker-mutator/stryker-net/pull/3047

If you feel you can address these issues, I will assign you