LiteObservableLogs 1.0.0
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
dotnet add package LiteObservableLogs --version 1.0.0
NuGet\Install-Package LiteObservableLogs -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="LiteObservableLogs" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LiteObservableLogs" Version="1.0.0" />
<PackageReference Include="LiteObservableLogs" />
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 LiteObservableLogs --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LiteObservableLogs, 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 LiteObservableLogs@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=LiteObservableLogs&version=1.0.0
#tool nuget:?package=LiteObservableLogs&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LiteObservableLogs
Lightweight observable logging with file output, Serilog-style fluent configuration, and Microsoft.Extensions.Logging integration—fewer moving parts, predictable behavior for desktop and library scenarios.
Features
- Fluent
LoggerConfiguration— chainWriteTo,ObserveTo,Global,MinimumLevel, andDispatchersimilar to common Serilog-style APIs. Microsoft.Extensions.Logging— register viaAddLiteObservableLogs(with optional options callback or prebuiltObservableLoggerOptions).- Static
Logfacade —Log.Information(...),Log.Received, and assignableLog.Loggerfor quick apps. - Multiple sinks — file (rolling by time and/or size), console or
Debug, in-processLog.Received, andObserveTo.Callbackwith optional per-sink output templates. - Global output template —
Global.OutputTemplate(...)applies when a sink omits its own template (same idea as shared format strings). - Runtime tuning —
Log.Logger.MinimumLevelandLog.Logger.OutputTemplateare get/set and affect subsequent writes without rebuilding the logger. - Retention & collision handling — optional retained file count/age; size rolling can back up a conflicting target path to
*.bakwhen the file name template would collide (e.g. missing{Count}).
Usage
Fluent configuration
using LiteObservableLogs;
using System.IO;
string logFile = Path.Combine(AppContext.BaseDirectory, "log", "observable_{Timestamp:yyyyMMdd}_{Count:d5}.log");
Log.Logger = new LoggerConfiguration()
.WriteTo.File(
logFile,
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 31,
retainedFileTimeLimit: TimeSpan.FromDays(21),
rollingSize: 10240L) // KB threshold for size-based roll
.WriteTo.Console(target: ConsoleTarget.Debug)
.ObserveTo.Event()
.ObserveTo.Callback(e => { /* handle ObservableLogEvent */ }, outputTemplate: null)
.Global.OutputTemplate("{Timestamp:yyyy-MM-dd HH:mm:ss.fff}|{Level:u5}|{Message}{NewLine}{Exception}")
.Dispatcher.Async()
.MinimumLevel.Debug()
.CreateLogger();
Log.Information("Application started");
Static Log and Log.Received
using LiteObservableLogs;
Log.Received += (_, e) => Console.WriteLine(e.RenderedText);
Log.Warning("Something happened");
Log.CloseAndFlush();
Microsoft.Extensions.Logging host
using LiteObservableLogs.Providers;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
Host.CreateDefaultBuilder(args)
.ConfigureLogging(builder =>
{
builder.ClearProviders();
builder.AddLiteObservableLogs(options =>
{
options.LogFolder = Path.Combine(AppContext.BaseDirectory, "logs");
options.FileName = "app.log";
options.MinLevel = LogLevel.Information;
});
})
.Build()
.Run();
Optional compatibility helper (name only): builder.AddSerilog() maps to current Log options when you already use that pattern elsewhere.
Output templates
- Per sink — pass
outputTemplateonWriteTo.File,WriteTo.Console,ObserveTo.Event, orObserveTo.Callback. - Global fallback —
Global.OutputTemplate("...")is used when a sink-specific template is omitted or null. - Tokens — supports placeholders such as
{Timestamp},{Level},{Message},{Exception},{SourceContext},{NewLine},{StackFrames}, caller and thread tokens, etc.
ObserveTo.Event vs ObserveTo.Callback
ObserveTo.Event— raisesLog.Receivedwith the formattedObservableLogEvent(same isolation semantics as multicast handlers).ObserveTo.Callback— registers anAction<ObservableLogEvent>; remove withLog.Logger.RemoveCallback(action)when you no longer need it.
Runtime MinimumLevel and OutputTemplate
Log.Logger.MinimumLevel = LogLevel.Warning;
Log.Logger.OutputTemplate = "{Timestamp:O}|{Level:u3}|{Message}";
Changes apply to subsequent log writes (including async formatting where applicable).
File name templates and rolling
- Use
{Timestamp:format}and{Count:format}inWriteTo.Filepaths for time- and size-based rotation. - If size rolling produces the same resolved file name as the active file (for example when
{Count}is absent from the template), the library moves the existing file aside asoriginal.log.bak(overwriting an existing.bak) before continuing.
Requirements
- Target frameworks —
net48,netstandard2.0(seeLiteObservableLogs.csproj). - Dependencies —
Microsoft.Extensions.Logging/Abstractions(versions as referenced by the project).
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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. net7.0 is compatible. 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 is compatible. 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 is compatible. 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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- Microsoft.Extensions.Logging (>= 10.0.6)
-
.NETFramework 4.7.2
- Microsoft.Extensions.Logging (>= 10.0.6)
-
.NETFramework 4.8
- Microsoft.Extensions.Logging (>= 10.0.6)
-
.NETStandard 2.0
- Microsoft.Extensions.Logging (>= 10.0.6)
-
.NETStandard 2.1
- Microsoft.Extensions.Logging (>= 10.0.6)
-
net10.0
- Microsoft.Extensions.Logging (>= 10.0.6)
-
net6.0
- Microsoft.Extensions.Logging (>= 10.0.6)
-
net7.0
- Microsoft.Extensions.Logging (>= 10.0.6)
-
net8.0
- Microsoft.Extensions.Logging (>= 10.0.6)
-
net9.0
- Microsoft.Extensions.Logging (>= 10.0.6)
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 | 117 | 4/15/2026 |