Serilog.Settings.XML2
3.1.0
See the version list below for details.
dotnet add package Serilog.Settings.XML2 --version 3.1.0
NuGet\Install-Package Serilog.Settings.XML2 -Version 3.1.0
<PackageReference Include="Serilog.Settings.XML2" Version="3.1.0" />
paket add Serilog.Settings.XML2 --version 3.1.0
#r "nuget: Serilog.Settings.XML2, 3.1.0"
// Install Serilog.Settings.XML2 as a Cake Addin #addin nuget:?package=Serilog.Settings.XML2&version=3.1.0 // Install Serilog.Settings.XML2 as a Cake Tool #tool nuget:?package=Serilog.Settings.XML2&version=3.1.0
Serilog.Settings.XML
A Serilog settings provider that reads from XML sources, like XML files
or XElement. This is a fork of the Serilog.Settings.Configuration and supoorts most of its use cases, but with much less dependencies.
By default, the configuration is read from the root element of a XML file
.
<Serilog>
<Using>Serilog.Sinks.Console</Using>
<Using>Serilog.Sinks.File</Using>
<MinimumLevel>Debug</MinimumLevel>
<WriteTo Name="Console" />
<WriteTo Name="File">
<Path>Logs/log.txt</Path>
</WriteTo>
<Enrich Name="FromLogContext" />
<Enrich Name="WithMachineName" />
<Enrich Name="WithThreadId" />
<Destructure Name="With">
<Policy>Sample.CustomPolicy, Sample</Policy>
</Destructure>
<Destructure Name="ToMaximumDepth">
<MaximumDestructuringDepth>4</MaximumDestructuringDepth>
</Destructure>
<Destructure Name="ToMaximumStringLength">
<MaximumStringLength>100</MaximumStringLength>
</Destructure>
<Destructure Name="ToMaximumCollectionCount">
<MaximumCollectionCount>10</MaximumCollectionCount>
</Destructure>
<Property Name="Application" Value="Sample" />
</Serilog>
After installing this package, use ReadFrom.XML()
and pass a path to a XML file
or a XElement object as the root element to read from.
static void Main(string[] args)
{
var logger = new LoggerConfiguration()
.ReadFrom.XML("config.xml")
.CreateLogger();
logger.Information("Hello, world!");
}
This example relies on the Serilog.Sinks.Console, Serilog.Sinks.File, Serilog.Enrichers.Environment and Serilog.Enrichers.Thread packages also being installed.
Syntax and structure
Please have a look in the Wiki for information about the XML structure and capabilities of this provider
Acknowledgement
This project depends heavily on the sources of Serilog.Settings.Configuration
Product | Versions 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. 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. |
.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 was computed. |
.NET Framework | net452 is compatible. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. 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. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release