Hanson.NLog.Config
3.0.3
dotnet add package Hanson.NLog.Config --version 3.0.3
NuGet\Install-Package Hanson.NLog.Config -Version 3.0.3
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="Hanson.NLog.Config" Version="3.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hanson.NLog.Config" Version="3.0.3" />
<PackageReference Include="Hanson.NLog.Config" />
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 Hanson.NLog.Config --version 3.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Hanson.NLog.Config, 3.0.3"
#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 Hanson.NLog.Config@3.0.3
#: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=Hanson.NLog.Config&version=3.0.3
#tool nuget:?package=Hanson.NLog.Config&version=3.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
README
Hanson.NLog.Config
主要功能
- 提供 NLog 匯出格式
- 支援匯出 Console
- 支援匯出 logstash 使用 GELF 格式
- 支援匯出 檔案格式 (預設停用)
前置條件
- 開發環境需具備 .Net 8.0
- 運行於 Windows Platform (x64)
- 運行於 Linux Platform (x64)
- 運行於 Raspberry PI Platform (x64)
安裝方式
- 採用 Nuget 方式進行安裝作業 https://www.nuget.org/packages/Hanson.NLog.Config/
授權
此專案採用的 License為 Apache-2.0
使用範例
命名空間
using Hanson.NLog.Config;
- 啟用 NLog 套件
private void Program()
{
// ....
// 加入 NLog 取用指令,在 builder.Build() 之前
builder.Logging.ClearProviders();
builder.Host.UseNLog();
var app = builder.Build();
if (app.Environment.IsDevelopment() || app.Environment.IsStaging())
{
//...
}
else
{
app.UseHttpsRedirection();
}
}
- 導入 LogContextMiddleware 取得 TraceId & UserId
private void Program()
{
// ....
// 加入 NLog 取用指令,在 builder.Build() 之前
builder.Logging.ClearProviders();
builder.Host.UseNLog();
var app = builder.Build();
if (app.Environment.IsDevelopment() || app.Environment.IsStaging())
{
//...
}
else
{
app.UseHttpsRedirection();
}
// ...
app.UseAuthorization();
// 放在 Auth 之後,才能在 Middleware 裡抓到 context.User
app.UseMiddleware<LogContextMiddleware>();
}
| 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
- NLog (>= 6.0.4)
- NLog.Targets.Http (>= 1.0.20)
- NLog.Targets.Network (>= 6.0.4)
- NLog.Web.AspNetCore (>= 6.0.4)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on Hanson.NLog.Config:
| Package | Downloads |
|---|---|
|
Hanson.KafkaSharp.Utils
KafkaSharp.Utils 主要在簡化Kafka-Sharp輸入設定參數,並使用非同步方式實現Consumer and Producer Hanson.KafkaSharp.Utils 使用須知 1- Kafka 傳送訊息容量預設 1MB ,會依據傳送的內容動態調整傳送訊息容量 (最大可傳送訊息量依Server設定為上限) 2- Kafka 接收訊息容量預設 200MB 3- 支援訂閱多個主題功能 支援作業平台: Windows x86, x64 Linux x64, x32 OSX x64 Raspberry PI x64, x32 |
|
|
Hanson.Mono.Common.SDK
Mono.Common.SDK 使用須知 1- 僅支援 x86 的平台使用 |
|
|
Hanson.Common.Extensions
Package Description |
|
|
Hanson.Common.HttpUtils
Package Description |
|
|
Hanson.Common.SystemUtils
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.