Getting Started

Overview

The LogView provides a UI for displaying and filtering log entries from Microsoft.Extensions.Logging.

The sample app using the light theme.

Using the LogView

Packages

<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />

Theme

<Application.Styles>
    <FluentTheme Mode="Dark"/>
    
    <!-- Ensure you add a theme -->
    <StyleInclude Source="avares://Aldwych.LogView/BasicTheme.axaml"/>
</Application.Styles>

LogProvider

//Place this somewhere early in your application life-cycle 

private readonly ILogger logger;

//The creation of the provider and logger obviously need to be in a method.
var provider = new LogControlLoggerProvider(new LogControlLoggerConfiguration() 
{ 
    LogLevel = LogLevel.Trace 
});

logger = provider.CreateLogger("App");

Using the LogView Control

<!-- Add the xaml namespace -->
xmlns:lv="clr-namespace:Aldwych.Controls;assembly=Aldwych.LogView"

<!-- Create the control -->
<lv:LogView/>

Last updated

Was this helpful?