VFK.Extensions.Logging 1.0.1

Suggested Alternatives

Vestfold.Extensions.Logging

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

VFK.Extensions.Logging

Contains builder extensions for configuring logging in a dotnet core application.

Usage in an Azure Function / Azure Web App

Add the following to your local.settings.json file:

Optional properties:

  • AppName: If not set, the assembly name will be used
  • Version: If not set, the assembly version will be used
{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
    "AppName": "Name of your application, used as a property in the logs",
    "BetterStack_SourceToken": "Your BetterStack source token",
    "BetterStack_Endpoint": "https://foo.betterstackdata.com",
    "BetterStack_MinimumLevel": "Information",
    "Version": "1.0.0"
  }
}

Override minimum levels for certain namespaces

Example: Add an override for everything in the Microsoft namespace to log from Warning and higher

{
  "Values": {
    "Serilog_MinimumLevel_Override_Microsoft": "Warning"
  }
}

Usage outside Azure

Add the following to your appsettings.json file:

Optional properties:

  • AppName: If not set, the assembly name will be used
  • Version: If not set, the assembly version will be used
{
  "AppName": "Name of your application, used as a property in the logs",
  "BetterStack": {
    "SourceToken": "Your BetterStack source token",
    "Endpoint": "https://foo.betterstackdata.com",
    "MinimumLevel": "Information"
  },
  "Version": "1.0.0"
}

Override minimum levels for certain namespaces

Example: Add an override for everything in the Microsoft namespace to log from Warning and higher

{
  "Serilog": {
    "MinimumLevel": {
      "Override": {
        "Microsoft": "Warning"
      }
    }
  }
}

Setting up logging for an Azure Function / Azure Web App

var builder = FunctionsApplication.CreateBuilder(args);
builder.ConfigureFunctionsWebApplication();
builder.Logging.AddVfkLogging();
builder.Build().Run();

Setting up logging for a HostBuilder (Console app, ClassLibrary, etc.)

public static async Task Main(string[] args)
{
    await Host.CreateDefaultBuilder(args)
        .ConfigureLogging(builder => builder.AddVfkLogging())
        .Build()
        .RunAsync();

    await Serilog.Log.CloseAndFlushAsync();
}

Setting up logging for a WebApplicationBuilder (WebAPI, Blazor, etc.)

var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddVfkLogging();

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.