LogConverter 1.0.2

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

LogConverter

Kullanımı kolay, genişletilebilir log formatlama kütüphanesi

LogConverter; standart .NET LogEntry modelinizi çeşitli formatlara (Markdown, HTML, CSV, JSON, XML) dönüştürmenizi sağlayan, renklendirme, özet, grup başlıkları ve katlanabilir detaylar gibi gelişmiş özelleştirmeler sunan bir NuGet paketidir.


Özellikler

  • Markdown , HTML , CSV , JSON , XML çıktı desteği
  • Seviyeye göre (INFO/WARN/ERROR) renkli veya renksiz stil uygulama
  • Özet bölümü: Toplam, hata, uyarı, bilgi sayıları
  • Gruplama : Herhangi bir LogEntry.Properties anahtarına göre satır başlıkları
  • Katlanabilir detay (<details>): Uzun mesaj ve exception metinlerini özetle saklama
  • Dosya (_.txt, _.csv, _.json, _.xml* ) okuma ve tek adımda işleyip formatlama

Kurulum

# .NET CLI ile
dotnet add package LogConverter --version 1.0.0

# Paket varsa güncellemek için
dotnet package update LogConverter

NuGet üzerinde en güncel sürümü kontrol edebilirsiniz: https://www.nuget.org/packages/LogConverter


Hızlı Başlangıç

Basit Markdown çıktısı

using LogConverter.Formatters;
using LogConverter.Models;

var logs = new List<LogEntry> {
  new LogEntry { Timestamp = DateTime.Now, Level = "INFO", Message = "Başlatılıyor" },
  new LogEntry { Timestamp = DateTime.Now, Level = "ERROR", Message = "Bir hata oluştu" }
};

string markdown = LogFormatter.Format(
  logs,
  LogFormat.Markdown,
  new LogFormatterOptions { UseColor = true }
);
Console.WriteLine(markdown);

Tam HTML raporu (WebView için ideal)

var html = LogFormatter.Format(
  logs,
  LogFormat.Html,
  new LogFormatterOptions {
    UseColor      = true,
    IncludeStyles = true,
    EnableSummary = true
  }
);
// WebView.Source = new HtmlWebViewSource { Html = html };

JSON çıktısını dosyaya yazma

byte[] bytes = LogFormatter.FormatToBytes(
  logs,
  LogFormat.Json,
  new LogFormatterOptions { AsFile = true, FileName = "logs.json" }
);
File.WriteAllBytes("logs.json", bytes);

Dosya Okuma & Formatlama

// log.txt, logs.csv, logs.json, logs.xml gibi dosyaları otomatik algılar:
string html = LogFormatter.FormatFile(
  "path/to/log.txt",
  LogFormat.Html,
  new LogFormatterOptions { UseColor = true }
);

API Referansı

LogFormatter.Format

string Format(
  IEnumerable<LogEntry> logs,
  LogFormat format,
  LogFormatterOptions options
);
  • logs : İşlenecek LogEntry listesi
  • format : Markdown, Html, Csv, Json, Xml
  • options : Renk, özet, grup, stil, katlanabilir detay gibi seçenekler

LogFormatter.FormatFile

string FormatFile(
  string filePath,
  LogFormat format,
  LogFormatterOptions options
);
  • Dosyayı (.txt, .json, .csv, .xml) okuyup direkt formatlar

LogFormatterOptions

Özellik Açıklama Varsayılan
UseColor Seviyeye göre renk uygulasın mı false
AsFile Format sonucu byte[] dönsün mü (dosya için) false
FileName Dosya adı (AsFile=true olduğunda) ""
IncludeStyles HTML içinde dahili CSS eklesin mi true
EnableSummary Özet bilgisini eklesin mi true
FoldLongMessages Uzun mesajları <details>ile katlasın mı true
FoldMessageLength Katlama eşiği (karakter) 100
GroupByProperty LogEntry.Propertiesiçinden grup başlığı eklemek mi? (anahtar) null

Katkıda Bulunma

  1. Forklayın
  2. Feature branch açın
  3. PR gönderin
  4. Kodumuza bakılarak merge edilecektir

Lisans

MIT © [Mehmet Akbaba]

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.
  • net8.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.0.2 155 4/24/2025
1.0.1 157 4/24/2025
1.0.0 161 4/24/2025