Dawning.Logging
1.0.1
dotnet add package Dawning.Logging --version 1.0.1
NuGet\Install-Package Dawning.Logging -Version 1.0.1
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="Dawning.Logging" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dawning.Logging" Version="1.0.1" />
<PackageReference Include="Dawning.Logging" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Dawning.Logging --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dawning.Logging, 1.0.1"
#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.
#:package Dawning.Logging@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Dawning.Logging&version=1.0.1
#tool nuget:?package=Dawning.Logging&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Dawning.Logging
Serilog 结构化日志库。
安装
dotnet add package Dawning.Logging
功能
- Serilog 集成 - 预配置的日志设置
- 多输出 - 控制台、文件、Seq
- 日志丰富 - 请求上下文自动添加
使用
注册日志
builder.AddDawningLogging(options =>
{
options.ApplicationName = "MyService";
options.EnableConsole = true;
options.EnableFile = true;
options.FilePath = "logs/app-.log";
options.SeqServerUrl = "http://localhost:5341"; // 可选
});
使用日志丰富中间件
app.UseDawningLogEnrichment();
配置选项
| 选项 | 说明 | 默认值 |
|---|---|---|
ApplicationName |
应用名称 | - |
EnableConsole |
启用控制台输出 | true |
EnableFile |
启用文件输出 | false |
FilePath |
日志文件路径 | logs/app-.log |
SeqServerUrl |
Seq 服务器地址 | null |
| 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Serilog (>= 4.0.0)
- Serilog.AspNetCore (>= 8.0.2)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Enrichers.Thread (>= 3.1.0)
- Serilog.Expressions (>= 5.0.0)
- Serilog.Sinks.Console (>= 6.0.0)
- 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.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 163 | 1/2/2026 |