Serilog.Extensions 8.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Serilog.Extensions --version 8.0.2                
NuGet\Install-Package Serilog.Extensions -Version 8.0.2                
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="Serilog.Extensions" Version="8.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Serilog.Extensions --version 8.0.2                
#r "nuget: Serilog.Extensions, 8.0.2"                
#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.
// Install Serilog.Extensions as a Cake Addin
#addin nuget:?package=Serilog.Extensions&version=8.0.2

// Install Serilog.Extensions as a Cake Tool
#tool nuget:?package=Serilog.Extensions&version=8.0.2                

Serilog Extensions for WebApplicationBuilder

This NuGet package provides extension methods to easily configure Serilog in your .NET applications. It supports WebApplicationBuilder, IHostBuilder, and IServiceCollection.

Installation

Install the package from NuGet:

dotnet add package Serilog.Extensions

Usage

This package provides two main extension methods for WebApplicationBuilder:

  1. UseSeriLogger()
  2. UseSerilogWithJsonFileBuilder()

UseSeriLogger()

This method configures Serilog using the default appsettings.json file.

using YourNamespace;

var builder = WebApplication.CreateBuilder(args);
builder.UseSeriLogger();

UseSerilogWithJsonFileBuilder()

This method allows you to specify a separate JSON file for Serilog configuration.

using YourNamespace;

var builder = WebApplication.CreateBuilder(args);
builder.UseSerilogWithJsonFileBuilder();

To use this method, you need to add a JsonFileSettingsOptions section to your appsettings.json:

{
  "JsonFileSettingsOptions": [
    {
      "Filename": "appsettings-serilog.json",
      "Optional": false,
      "ReloadOnChange": true
    }
  ]
}

Then, create an appsettings-serilog.json file with your Serilog configuration:

{
  "Serilog": {
    "Using": [ "Serilog.Sinks.Console" ],
    "MinimumLevel": "Information",
    "WriteTo": [
      { "Name": "Console" }
    ],
    "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
  }
}

Configuration Options

The JsonFileSettingsOptions allows you to specify:

  • Filename: The name of the Serilog configuration file.
  • Optional: Whether the file is optional (if false, an exception will be thrown if the file is not found).
  • ReloadOnChange: Whether to reload the configuration if the file changes.

License

Richard MAH

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Serilog.Extensions:

Package Downloads
GN2.Business.Base

Provides a api library for business services.

Kmd.CqrsCore

Package Description

Zokhrof.Appbase.Messenger

Package Description

ItTitansGmbh.Utility.SeriLogSQLTranslator

SeriLogSQL Translator is a powerful and user-friendly tool designed to bridge the gap between SeriLog and SQL. Leveraging a robust parsing system, it transforms SeriLog log strings into executable SQL commands, eliminating the need for manual translation and making your database interactions more efficient and reliable.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.3 227 11/18/2024
8.0.2 6,366 9/13/2024
8.0.1 30,719 7/10/2024
8.0.0 32,254 1/18/2024
7.1.0 1,540 5/3/2024
7.0.0 1,232 1/28/2024
3.4.3 322 1/18/2024
3.4.2 12,009 8/17/2023
3.4.0 7,328 5/20/2023
3.3.1 2,082 3/14/2023
3.3.0 3,458 2/21/2023
3.2.2 447 2/21/2023
3.2.1 423 2/21/2023
3.2.0 584 2/5/2023
3.1.0 2,399 12/8/2022
3.0.0 797 11/25/2022
2.2.2 21,482 10/4/2022
2.2.1 581 10/3/2022
2.2.0 899 9/30/2022
2.1.0 1,971 9/14/2022
2.0.1 15,519 6/1/2022
2.0.0 6,486 5/25/2022
1.1.5 27,468 4/5/2022
1.1.4 992 3/14/2022
1.1.3 618 3/14/2022
1.1.2 609 3/14/2022
1.1.1 616 3/14/2022
1.1.0 846 3/14/2022