ColoredConsoleLog 1.0.0

dotnet add package ColoredConsoleLog --version 1.0.0
                    
NuGet\Install-Package ColoredConsoleLog -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ColoredConsoleLog" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ColoredConsoleLog" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ColoredConsoleLog" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ColoredConsoleLog --version 1.0.0
                    
#r "nuget: ColoredConsoleLog, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ColoredConsoleLog@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ColoredConsoleLog&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ColoredConsoleLog&version=1.0.0
                    
Install as a Cake Tool

ColoredConsoleLog

Make the log output in your WPF application beautiful!

This is a small UserControl for WPF to output logs in different colors, depending on preferences, configurable with regular expressions.

By default, changes the color of text in '', "", Windows File Path, URL, [], or if the string contains the text Error or Warning

NuGet stable version

How to use

XAML

<ColoredConsoleLog LogText="{Binding LogText}" />

Code

public ObservableCollection<string> LogText { get; set; } = new();

Add log

const string testText = "test text";
for (var i = 1; i <= 50; i++)
{
    LogText.Add($"default {testText} N{i}");
    LogText.Add($"'{testText}'");
    LogText.Add($@"""{testText}""");
    LogText.Add($@"C:\Windows\{testText}.txt");
    LogText.Add("https://google.com");
    LogText.Add($"[{testText}]");
    LogText.Add($"warning {testText}");
    LogText.Add($"error {testText}");
    LogText.Add("");
}

Add custom text pattern

Create settings instance

 public LogSettings LogSettings { get; set; } = new();

Add new regex and color

LogSettings.RegexColor.Add(
            new Regex("(==.*?==)"),
            new SolidColorBrush("#A78295".ColorFromHex()));

And add settings instance to XAML

<ColoredConsoleLog
            LogText="{Binding LogText}"
            Settings="{Binding LogSettings}" />

Watch example in TestApp

TestLog

Product Compatible and additional computed target framework versions.
.NET net7.0-windows7.0 is compatible.  net8.0-windows was computed.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 210 9/4/2023