CFLog 1.1.2

dotnet add package CFLog --version 1.1.2
                    
NuGet\Install-Package CFLog -Version 1.1.2
                    
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="CFLog" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CFLog" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="CFLog" />
                    
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 CFLog --version 1.1.2
                    
#r "nuget: CFLog, 1.1.2"
                    
#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 CFLog@1.1.2
                    
#: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=CFLog&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=CFLog&version=1.1.2
                    
Install as a Cake Tool

CFLog C# Logger for Windows .NET 6,7,8,9

仕様等詳細はこちら(日本語)

使用方法やAPIについての詳細は上記ドキュメントを参照してください。
サンプルプログラムやxUnitプロジェクトが必要な場合は GitHub から取得してください。

仕様・コンセプト

  • 業務製品開発に耐えうる品質
  • 1プロセスにつき1種類のログファイル
  • 同一アプリを複数起動するマルチプロセスには自動サブフォルダ振分けで対応
  • ログファイルの容量制限はなく、1日1ログファイルで指定保管日数を超えたファイルを削除していく方式
  • アプリケーションクラッシュ時のログ消失率を下げるため、ログ出力ごとに Flush
  • ログ種別のフィルタリングはユーザ指定のラムダ式(デリゲート)
  • スレッドセーフ
  • シングルトン
  • using staticディレクティブとの組合わせでシンプルなコード表記
  • デバッガへのログメッセージ同時出力
  • 実行は日本語と日本語以外(英語)に対応
  • 実行環境とは異なるタイムゾーン指定が可能

Specifications and Concept

  • Quality that can withstand business product development
  • One type of log file per process
  • Automatic subfolder allocation for multi-processes that launch the same app multiple times
  • No log file capacity limit, one log file per day, files that exceed the specified storage period are deleted
  • Flush for each log output to reduce the rate of log loss when the application crashes
  • User-specified lambda expression (delegate) for filtering log types
  • Thread-safe
  • Singleton
  • Simple code notation in combination with the using static directive
  • Simultaneous output of log messages to the debugger
  • Supports execution in Japanese and non-Japanese (English)
  • Time zone different from the execution environment can be specified

使用例(Exsample)

global using

using static CFLog.Logger;
using static CFLog.Logger.LogType;

初期化(Itialization)

static void Main()
{
    ApplicationConfiguration.Initialize();
    try
    {
        // ログ機能設定(Log function settings)
        var logDef = new LoggerDef()
        {
            FILE_PREFIX = "SampleAPP",
        };
        // ログ開始(Start)
        using(CreateLogger(logDef))
        {
            Application.Run(new SampleForm());
        }
    } catch(LoggerException ex)
    {
        MessageBox.Show(ex.Message);
    }
}

ログ出力(Output)

LOG.Write(I, "情報メッセージ");
LOG.Write(E, "エラーメッセージ","追加情報\n何行でもOK");

ログテキスト(Log text)

日本語OSの場合の例。日本語以外の場合は開始、終了メッセージなどは英語になります。
Example for a Japanese OS. For non-Japanese OS, the start and end messages will be in English.

2024-04-30 16:25:15.422 <25956:01> === ログを開始します ===  [Tokyo Standard Time]
2024-04-30 16:25:17.683 <25956:01> I [Sample01Form.cs(L.12)]: 情報メッセージ
2024-04-30 16:25:17.684 <25956:01> E [Sample01Form.cs(L.13)]: エラーメッセージ
                                   追加情報
                                   何行でもOK
2024-04-30 16:25:19.379 <25956:01> === ログを終了します ===
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net7.0-windows7.0 is compatible.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0-windows7.0

    • No dependencies.
  • net7.0-windows7.0

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.
  • net9.0-windows7.0

    • No dependencies.

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.1.2 338 4/9/2025
1.1.1 199 7/26/2024
1.1.0 201 7/3/2024
1.0.0 214 6/27/2024

NET 6.0 - 8.0 were previously targeted, but .NET 9.0 was added as a target.
No other changes.
これまで、.NET 6.0 - 8.0 がターゲットだったが、.NET 9.0 をターゲットに追加。
その他の変更はなし。