DpConfig 1.0.0
See the version list below for details.
dotnet add package DpConfig --version 1.0.0
NuGet\Install-Package DpConfig -Version 1.0.0
<PackageReference Include="DpConfig" Version="1.0.0" />
paket add DpConfig --version 1.0.0
#r "nuget: DpConfig, 1.0.0"
// Install DpConfig as a Cake Addin #addin nuget:?package=DpConfig&version=1.0.0 // Install DpConfig as a Cake Tool #tool nuget:?package=DpConfig&version=1.0.0
DpConfig - Sets up console configuration and logging
Namespace: DpUtilities
Nuget Package Name: DpConfig
Dependencies: DpUtilities, Serilog
Introduction
May be called at the head of a console application to create a configuration environment and (optionally) a Serilog logger. The configuration gives access to environment variables and to an appsettings.json file, which is assumed to be at the application's root.
If a logger is specified, the appsettings.json file must contain a valid Serilog
section.
The logger can be accessed by the global static instance Log
.
Constructor
public DpConfig (bool withLogging = true)
Logging is assumed by default. Set withLogging
to false to set up configuration without logging.
Property
Property Config - Returns the configuration instance
public IConfigurationRoot Config { get; private set; }
Once the configuration has been constructed, a reference to it is available to the main program via this property.
Sample Serilog
section in appsettings.json
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft.EntityFrameworkCore.Database.Command": "Error",
"Microsoft.EntityFrameworkCore": "Error",
"Microsoft": "Warning",
"System": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message:lj}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "d:\\Temp\\LogTest.log",
"rollingInterval": "Day",
"retainedFileCountLimit": 31,
"outputTemplate": "{Timestamp:yy-MMM-dd HH:mm:ss.fff} [{Level:u3}] {Message:lj}{NewLine}{Exception}"
}
}
]
},
"TestSection": {
"TestString": "My Test String"
}
}
Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Serilog (>= 3.1.1)
- Serilog.Settings.Configuration (>= 8.0.0)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.File (>= 5.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.
Initial