Blip.Starter.Common.Logs 0.0.23

dotnet add package Blip.Starter.Common.Logs --version 0.0.23                
NuGet\Install-Package Blip.Starter.Common.Logs -Version 0.0.23                
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="Blip.Starter.Common.Logs" Version="0.0.23" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Blip.Starter.Common.Logs --version 0.0.23                
#r "nuget: Blip.Starter.Common.Logs, 0.0.23"                
#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 Blip.Starter.Common.Logs as a Cake Addin
#addin nuget:?package=Blip.Starter.Common.Logs&version=0.0.23

// Install Blip.Starter.Common.Logs as a Cake Tool
#tool nuget:?package=Blip.Starter.Common.Logs&version=0.0.23                

Blip.Starter.Common.Logs

First of all, please read all pages of our Logging documentation.

You must configure your application to be able to have its logs collected correctly.

Configuring your application

.NET

Add Blip.Starter.Common.Traces NuGet package to your project to configure your application.

The NuGet package is published in our private NuGet repository: https://dev.azure.com/curupira/BLiP/_artifacts/feed/BlipNuget/NuGet/Blip.Starter.Common.Traces/overview/0.0.9

To access it locally you will need to install Azure Artifacts credential provider.

ASP.NET Core

Then, in your Startup.cs file or anywhere you configure the framework, add the following code:

// You can change the configuration if needed
ILogConfiguration configuration = DefaultLogConfiguration();
 
// Create the environment with correct values (read it from your configuration or environment variables)
Env.Environment environment = new Env.Environment("your-app-deploy-name", "your-app-deploy-version", "the-cluster-your-app-is-deployed");

// Integrate the Serilog log sink with the IServiceCollection using the extension from LogSinkExtension
services.AddLogSink(configuration, environment);

You can also use the .NET IConfiguration interface having the fields LogSink for the ILogConfiguration and $Metadata for the Env.Environment to configure your application as following:

// This is an example of how to get the configuration from the builder, but this code will already be in your application
var builder = WebApplication.CreateBuilder(args);
IConfiguration config = builder.Configuration;

builder.Services.AddLogSink(config);

Manual configuration

If you must configure Serilog sink manually because you do not use ASP.NET Core, you can do it like this:

// You can change the configuration if needed
ILogConfiguration configuration = DefaultLogConfiguration();

// Create the environment with correct values (read it from your configuration or environment variables)
Env.Environment environment = new Env.Environment("your-app-deploy-name", "your-app-deploy-version", "the-cluster-your-app-is-deployed");

Log.Logger = LoggerSimpleStarter.Create(loggerConfiguration, environment).CreateLogger();

Sending logs to Grafana Loki

After configuring the instrumentation, there is a few things you must ensure to have your logs sent to Grafana Loki.

Please read the documentation to know what to do.

Please make sure your cluster already have a Promtail configured by asking to SRE team.

Product Compatible and additional computed target framework versions.
.NET 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 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. 
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.

Version Downloads Last updated
0.0.23 121 7/25/2024
0.0.20 1,927 2/27/2024
0.0.19 82 2/22/2024
0.0.18 789 1/31/2024
0.0.17 415 12/28/2023
0.0.16 555 11/6/2023
0.0.15 290 10/19/2023
0.0.14 346 10/10/2023
0.0.12 208 9/26/2023