![]() |
VOOZH | about |
dotnet add package com.parallon.outpatient.serilog.sdk --version 1.0.9
NuGet\Install-Package com.parallon.outpatient.serilog.sdk -Version 1.0.9
<PackageReference Include="com.parallon.outpatient.serilog.sdk" Version="1.0.9" />
<PackageVersion Include="com.parallon.outpatient.serilog.sdk" Version="1.0.9" />Directory.Packages.props
<PackageReference Include="com.parallon.outpatient.serilog.sdk" />Project file
paket add com.parallon.outpatient.serilog.sdk --version 1.0.9
#r "nuget: com.parallon.outpatient.serilog.sdk, 1.0.9"
#:package com.parallon.outpatient.serilog.sdk@1.0.9
#addin nuget:?package=com.parallon.outpatient.serilog.sdk&version=1.0.9Install as a Cake Addin
#tool nuget:?package=com.parallon.outpatient.serilog.sdk&version=1.0.9Install as a Cake Tool
LoggingConfigurator is a singleton utility designed to configure Serilog logging in ASP.NET Core applications. It centralizes logging setup, enables dynamic log level changes at runtime, and integrates with the .NET dependency injection system.
LoggingLevelSwitchappsettings.json, environment-specific files, and environment variablesLoggingLevelSwitch for dependency injectionAdd NuGet Packages
Serilog.AspNetCoreSerilog.Settings.ConfigurationSerilog.Sinks.Console (or any other sinks you require)Configure in Program.cs
Use LoggingConfigurator to set up Serilog as your logging provider.
Dynamic Log Level Control
Inject LoggingLevelSwitch where needed to change log levels at runtime.
Configuration
Add Serilog settings to your appsettings.json.
Add the following Serilog section to your appsettings.json:
{
"Serilog": {
"Using": [ "Serilog.Sinks.GoogleCloudLogging" ],
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithEnvironmentName",
"WithEnvironmentUserName",
"WithThreadId",
"WithThreadName",
"WithProcessId",
"WithProcessName"
],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "GoogleCloudLogging",
"Args": {
"projectId": "${SERILOG__WRITETO__0__ARGS__PROJECTID}", // Uses environment variable substitution for configuration
"logName": "${SERILOG__WRITETO__0__ARGS__LOGNAME}",
"outputTemplate": "${SERILOG__WRITETO__0__ARGS__OUTPUTTEMPLATE}",
"useSourceContextAsLogName": false,
"labels": {
"environment": "${SERILOG__WRITETO__0__ARGS__LABELS__ENVIRONMENT}",
"Label1": "${SERILOG__WRITETO__0__ARGS__LABELS__LABEL1}",
"Label2": "${SERILOG__WRITETO__0__ARGS__LABELS__LABEL2}"
}
}
}
]
},
"AllowedHosts": "*"
// Other configuration settings...
}
This example demonstrates how to configure Serilog with Google Cloud Logging and various enrichers in your appsettings.json.
See the project license for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
Initial release.