Blip.Starter.Common.Logs
0.0.14
See the version list below for details.
dotnet add package Blip.Starter.Common.Logs --version 0.0.14
NuGet\Install-Package Blip.Starter.Common.Logs -Version 0.0.14
<PackageReference Include="Blip.Starter.Common.Logs" Version="0.0.14" />
paket add Blip.Starter.Common.Logs --version 0.0.14
#r "nuget: Blip.Starter.Common.Logs, 0.0.14"
// Install Blip.Starter.Common.Logs as a Cake Addin #addin nuget:?package=Blip.Starter.Common.Logs&version=0.0.14 // Install Blip.Starter.Common.Logs as a Cake Tool #tool nuget:?package=Blip.Starter.Common.Logs&version=0.0.14
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 | Versions 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. |
-
net6.0
- Blip.Starter.Common.Env (>= 0.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- murmurhash (>= 1.0.3)
- Serilog (>= 3.0.1)
- Serilog.Enrichers.Demystifier (>= 1.0.2)
- Serilog.Enrichers.Environment (>= 2.2.0)
- Serilog.Exceptions (>= 8.4.0)
- Serilog.Extensions.Hosting (>= 5.0.1)
- Serilog.Settings.Configuration (>= 7.0.0)
- Serilog.Sinks.Console (>= 4.1.0)
- Serilog.Sinks.Datadog.Logs (>= 0.5.2)
- Serilog.Sinks.Debug (>= 2.0.0)
- Serilog.Sinks.File (>= 5.0.0)
- Serilog.Sinks.Grafana.Loki (>= 8.1.0)
- Serilog.Sinks.Http (>= 9.0.0-beta.1)
- Serilog.Sinks.MSSqlServer (>= 6.3.0)
- Serilog.Sinks.Seq (>= 5.2.2)
- Serilog.Sinks.Trace (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.