Enrichers that add properties from Azure Web Apps environment variables.
To use the enrichers, first install the NuGet package:
Install-Package Collector.Serilog.Enrichers.AzureWebApps
Then, apply the enrichers to your LoggerConfiguration
:
Log.Logger = new LoggerConfiguration()
.Enrich.With<AzureWebAppsNameEnricher>()
.Enrich.With<AzureWebJobsNameEnricher>()
.Enrich.With<AzureWebJobsTypeEnricher>()
// ...other configuration...
.CreateLogger();
The package includes:
AzureWebAppsNameEnricher
- adds the name of the Azure WebApp the application runs withinAzureWebJobsNameEnricher
- adds the name of the Azure WebJob (if the application is a WebJob)AzureWebJobsTypeEnricher
- adds the type name of the Azure WebJob (continuous or triggered)