Oakrey.Applications.Log
6.0.2
dotnet add package Oakrey.Applications.Log --version 6.0.2
NuGet\Install-Package Oakrey.Applications.Log -Version 6.0.2
<PackageReference Include="Oakrey.Applications.Log" Version="6.0.2" />
<PackageVersion Include="Oakrey.Applications.Log" Version="6.0.2" />
<PackageReference Include="Oakrey.Applications.Log" />
paket add Oakrey.Applications.Log --version 6.0.2
#r "nuget: Oakrey.Applications.Log, 6.0.2"
#:package Oakrey.Applications.Log@6.0.2
#addin nuget:?package=Oakrey.Applications.Log&version=6.0.2
#tool nuget:?package=Oakrey.Applications.Log&version=6.0.2
Oakrey.Applications.Log
A .NET 10 library that integrates Oakrey logging into Windows applications via IServiceCollection extension methods. It provides a WpfQueueLogger-backed view model for real-time UI log visualization, settings-persisted log level filtering, and a preloadable cleanup service that removes log files older than 7 days.
Main features
ConfigureLoggingServices� initializesLoggerFactorybasic loggers and registersILogger<T>/LoggerProxy<T>as singletons in the DI container.ConfigureLogViewServices� registers aWpfQueueLoggersingleton (queue capacity 100) and a transientLogViewModelfor WPF binding.LogViewModel� bindable view model exposingWpfQueueLogger, a settings-persistedDisplayLogLevel(Level.Informationdefault), and a settings-persistedVerticalOffsetValue. Includes a design-time constructor that pre-populates sample log entries.LogFileCleanupService� implementsIPreLoadableandIDisposable. OnPreload(), deletes.logfiles older than 7 days fromDocuments\<AppName>\Logs. Reports failures asPreLoadingExceptionviaIObservable<PreLoadingException>backed by aReplaySubject.ILogConfig� interface for decoupled access toDisplayLogLevelandVerticalOffsetValue.
Architecture
classDiagram
class LoggingConfigurationExtension {
+AddOakreyLogging(IServiceCollection) IServiceCollection
+ConfigureLoggingServices(IServiceCollection) IServiceCollection
+ConfigureLogViewServices(IServiceCollection) IServiceCollection
}
class LogViewModel {
+WpfLogger : WpfQueueLogger
+DisplayLogLevel : Level
+VerticalOffsetValue : double
}
class LogFileCleanupService {
+Preload(CancellationToken) Task
+Subscribe(IObserver) IDisposable
+Dispose()
}
class ILogConfig {
<<interface>>
+DisplayLogLevel : Level
+VerticalOffsetValue : double
+GetValue~T~(string) T
}
class ILogFileCleanupService {
<<interface>>
}
LogViewModel ..|> INotifyPropertyChanged
LogViewModel ..|> ILogConfig
LogFileCleanupService ..|> ILogFileCleanupService
LogFileCleanupService ..|> IPreLoadable
LogFileCleanupService ..|> IDisposable
LoggingConfigurationExtension --> LogViewModel : registers
LoggingConfigurationExtension --> WpfQueueLogger : registers
Requirements
- .NET 10 (net10.0-windows)
- Windows
- Dependencies:
Oakrey.Applications.Settings,Oakrey.Log,Oakrey.Log.Windows
Installation
.NET CLI
dotnet add package Oakrey.Applications.Log
Package Manager Console
Install-Package Oakrey.Applications.Log
NuGet Package Manager in Visual Studio
Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution, search for Oakrey.Applications.Log, and install.
Usage
Registering logging services
Call both methods during application startup, typically in your DI composition root:
services
.ConfigureLoggingServices() // registers ILogger<T>, initializes LoggerFactory
.ConfigureLogViewServices(); // registers WpfQueueLogger + LogViewModel
AddOakreyLogging() is also available as a standalone call when you only need ILogger<T> registration without reinitializing LoggerFactory.
Binding LogViewModel in WPF
<ItemsControl ItemsSource="{Binding WpfLogger.Entries}">
...
</ItemsControl>
<ComboBox SelectedItem="{Binding DisplayLogLevel}" />
// inject via DI
public LogView(LogViewModel viewModel)
{
DataContext = viewModel;
InitializeComponent();
}
Registering the cleanup service
services.AddSingleton<ILogFileCleanupService, LogFileCleanupService>();
Then call Preload during application startup (or via the IPreLoadable pipeline):
await logFileCleanupService.Preload(cancellationToken);
Subscribe to failures if you want to surface them in the UI:
logFileCleanupService.Subscribe(ex =>
{
// ex.Message, ex.Detail, ex.InnerException available
});
Using ILogConfig
public class MyService(ILogConfig logConfig)
{
public void Apply()
{
Level level = logConfig.DisplayLogLevel;
}
}
Development notes
- Log file path � files are deleted from
Environment.SpecialFolder.MyDocuments\<IApplicationInfo.Name>\Logs. The application name is resolved via the injectedIApplicationInfo. - Retention period � hardcoded to 7 days (
TimeSpan(7, 0, 0, 0)). There is currently no configuration API for this value. - Design-time support �
LogViewModelhas a parameterless constructor that seeds sample entries atInformation,Debug, andErrorlevels, enabling XAML designer previews without DI. ReplaySubject�LogFileCleanupServiceusesReplaySubject<PreLoadingException>so late subscribers still receive exceptions that occurred before they subscribed. Dispose the service to release it.
Project information
| Field | Value |
|---|---|
| Package ID | Oakrey.Applications.Log |
| Author | Oakrey |
| License | MIT |
| Repository | ApplicationServices |
| Project URL | oakrey.cz |
| NuGet | Oakrey.Applications.Log |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Oakrey.Applications.Abstractions (>= 6.0.2)
- Oakrey.Applications.Files.Abstractions (>= 6.0.0)
- Oakrey.Log.Windows (>= 2.1.1)
- Oakrey.Telemetry (>= 2.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Oakrey.Applications.Log:
| Package | Downloads |
|---|---|
|
Oakrey.Applications.Base
A foundational .NET library for building modular WPF applications. Provides application lifecycle management, MVVM ViewModel resolution, structured logging, telemetry, and sequential or parallel service preloading with full unhandled-exception coverage. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.2 | 62 | 7/8/2026 |
| 6.0.1 | 96 | 7/3/2026 |
| 6.0.0 | 120 | 5/22/2026 |
| 4.0.5 | 107 | 5/22/2026 |
| 4.0.4 | 109 | 5/15/2026 |
| 4.0.3 | 133 | 3/13/2026 |
| 4.0.2 | 143 | 2/13/2026 |
| 4.0.1 | 142 | 2/11/2026 |
| 4.0.0 | 458 | 11/18/2025 |
| 3.0.1 | 213 | 10/31/2025 |
| 3.0.0 | 225 | 10/22/2025 |
| 2.0.2 | 203 | 10/10/2025 |
| 2.0.1 | 263 | 9/29/2025 |
| 2.0.0 | 409 | 6/11/2025 |
| 1.0.0 | 308 | 4/17/2025 |