Aldwych-Controls / Aldwych.LogView

An Avalonia Log Control that integrates with Microsoft.Extensions.Logging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🦟 Aldwych.LogView

An Avalonia UI Log Control that integrates with Microsoft.Extensions.Logging

Log Provider

The LogView comes with a log provider which will handle intercepting log massages for display. The most basic way of using this would be:

//Create a log provider
var provider = new LogControlLoggerProvider(new LogControlLoggerConfiguration() 
{ 
    LogLevel = LogLevel.Trace 
});
// Create a logger
var logger = provider.CreateLogger("App");

//Log something 
logger.LogInformation("info test");

LogView Control

<lv:LogView x:Name="logView" LogLevelFilter="{Binding #filterCmb.SelectedIndex, Source=PropertyChanged}" />

Basic Theme

Usage

Edit the App.axaml file to look like the following:

    <Application.Styles>
        <FluentTheme Mode="Dark"/>
        <StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Default.xaml"/>
        <StyleInclude Source="avares://Aldwych.LogView/BasicTheme.axaml"/>
      <StyleInclude Source="avares://Aldwych.LogView/Styles/LogView.axaml"/>
    </Application.Styles>

Resource Names

You can tweak the basic theme by overriding the resources listed below.

Color Resources

<SolidColorBrush x:Key="DebugForeground" Color="#5EC8E1" />
<SolidColorBrush x:Key="ErrorForeground" Color="#FF6057" />
<SolidColorBrush x:Key="InfoForeground" Color="#51CA33" />
<SolidColorBrush x:Key="WarningForeground" Color="#FF9D42" />
<SolidColorBrush x:Key="TraceForeground" Color="#5EC8E1" />
<SolidColorBrush x:Key="CriticalForeground" Color="#E5E5E5" />

Icon Resources

<StreamGeometry x:Key="DebugLogMessageGeometry">...</StreamGeometry>
<StreamGeometry x:Key="ErrorLogMessageGeometry">...</StreamGeometry>
<StreamGeometry x:Key="InfoLogMessageGeometry">...</StreamGeometry>
<StreamGeometry x:Key="WarningLogMessageGeometry">...</StreamGeometry>
<StreamGeometry x:Key="TraceLogMessageGeometry">...</StreamGeometry>
<StreamGeometry x:Key="CriticalLogMessageGeometry">...</StreamGeometry>

Sample App

Light

screenshot of sample app with light theme

Dark

screenshot of sample app with dark theme

About

An Avalonia Log Control that integrates with Microsoft.Extensions.Logging

License:MIT License


Languages

Language:C# 100.0%