Hanson.NLog.Config 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Hanson.NLog.Config --version 3.0.0
                    
NuGet\Install-Package Hanson.NLog.Config -Version 3.0.0
                    
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.0" />
                    
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.0" />
                    
Directory.Packages.props
<PackageReference Include="Hanson.NLog.Config" />
                    
Project file
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.0
                    
#r "nuget: Hanson.NLog.Config, 3.0.0"
                    
#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.0
                    
#: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.0
                    
Install as a Cake Addin
#tool nuget:?package=Hanson.NLog.Config&version=3.0.0
                    
Install as a Cake Tool

README

Hanson.NLog.Config

主要功能

  1. 提供 NLog 匯出格式
    • 支援匯出 Console
    • 支援匯出 logstash 使用 GELF 格式
    • 支援匯出 檔案格式 (預設停用)

前置條件

  • 開發環境需具備 .Net 8.0
  • 運行於 Windows Platform (x64)
  • 運行於 Linux Platform (x64)
  • 運行於 Raspberry PI Platform (x64)

安裝方式

授權

此專案採用的 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 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.

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.

Version Downloads Last Updated
3.0.3 38 5/4/2026
3.0.2 38 5/4/2026
3.0.1 36 5/4/2026
3.0.0 39 5/4/2026
2.0.0 744 11/30/2024
1.1.0 1,480 12/30/2022
1.0.1 37,724 7/23/2021