LogViewWPF 1.0.0.3

dotnet add package LogViewWPF --version 1.0.0.3
                    
NuGet\Install-Package LogViewWPF -Version 1.0.0.3
                    
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="LogViewWPF" Version="1.0.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LogViewWPF" Version="1.0.0.3" />
                    
Directory.Packages.props
<PackageReference Include="LogViewWPF" />
                    
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 LogViewWPF --version 1.0.0.3
                    
#r "nuget: LogViewWPF, 1.0.0.3"
                    
#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 LogViewWPF@1.0.0.3
                    
#: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=LogViewWPF&version=1.0.0.3
                    
Install as a Cake Addin
#tool nuget:?package=LogViewWPF&version=1.0.0.3
                    
Install as a Cake Tool

LogViewWPF [日志显示页]

release nuget
language

Can be used to display live logs, comes with a simple search function.
可以用于显示实时日志,附带简单的搜索功能。

screenshot

Usage

Xaml

xmlns:logview="clr-namespace:LogViewWPF;assembly=LogViewWPF"

<logview:LogViewControl x:Name="logViewControl"/>

You can set line caps and colours for various log types.
你可以设置行上限和各种日志类型的颜色。

<logview:LogViewControl x:Name="logViewControl" Grid.Row="1" 
                MaxLine="1000" EnableSearch="True" ShowType="True"  Spacing="10,5"
                TraceBrush="LightGray" DebugBrush="Gray" InformationBrush="Black" WarningBrush="DarkOrange"
                ErrorBrush="Red" CriticalBrush="DarkRed"  SearchMatchBrush="#DDF5FF" SearchCurrentBrush="#FFFAE1"/>

If EnableSearch = "True", Ctrl+F shows the search bar, Esc hides it.
如果EnableSearch = "True",Ctrl+F 显示搜索栏,Esc 隐藏搜索栏

C#

* Basic 基本

Add logging to the display.
添加日志到显示。

logViewControl.AppendLog("log defualt level is Information");

logViewControl.AppendLog("append debug", LogLevel.Debug);
logViewControl.AppendLog("error text", LogLevel.Error);

List<(string,LogLevel)> lines = new List<(string, LogLevel)>();
for (int i = 0; i < 5; i++)
    lines.Add((GenerateRandomLog(), (LogLevel)(random.Next(0, 6))));
logViewControl.AppendMultiLog(lines);

//logViewControl.ClearLog();

LogLevel enumeration is consistent with Microsoft.Extensions.Logging.LogLevel, except that there is no "LogLevel.None".
日志等级枚举与 Microsoft.Extensions.Logging.LogLevel一致,除了没有"LogLevel.None"。

* Subscription 订阅

You can associate an Action with your own logging service.
你可以让你自己日志服务的 Action 与之关联。

public class LogHelper
{
    public Action<string> OnLogAppend { get; set; }
    public static void Log(string text)
    {
        //write to file
        OnLogAppend?.Invoke(text);
    }
}

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();

        LogHelper.OnLogAppend += OnLogAppend;

        LogHelper.Log("test")
    }
    public void OnLogAppend(string text)
    {
        logViewControl.AppendLog(text);
    }
}
* Filter 过滤类型

Filter Log Type Display.
过滤日志类型显示。

logViewControl.TypeFilter = new List<LogLevel>() { LogLevel.Information, LogLevel.Error };
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net471 is compatible.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • net6.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.3 288 4/30/2024
1.0.0.2 183 4/29/2024
1.0.0.1 187 4/28/2024
1.0.0 171 4/28/2024