Wima.Log
1.8.3
dotnet add package Wima.Log --version 1.8.3
NuGet\Install-Package Wima.Log -Version 1.8.3
<PackageReference Include="Wima.Log" Version="1.8.3" />
<PackageVersion Include="Wima.Log" Version="1.8.3" />
<PackageReference Include="Wima.Log" />
paket add Wima.Log --version 1.8.3
#r "nuget: Wima.Log, 1.8.3"
#:package Wima.Log@1.8.3
#addin nuget:?package=Wima.Log&version=1.8.3
#tool nuget:?package=Wima.Log&version=1.8.3
Wima.Log
A lightweight, independent logger for .NET that provides multi-target logging with Common.Logging and Microsoft.Extensions.Logging compatibility, plus built-in ElasticSearch connectivity.
一款轻量级独立 .NET 日志库,兼容 Common.Logging 和 Microsoft.Extensions.Logging,内置 ElasticSearch 连接支持。
Features / 功能特性
- Multi-target:
net10.0+netstandard2.0 - Dual interface: Implements both
Common.Logging.ILogandMicrosoft.Extensions.Logging.ILogger - Log modes: Console, Native file, ElasticSearch, CommonLog bridge
- Buffered ES indexing: Batch writes to ElasticSearch with configurable buffer
- Log rotation: Auto-renew log files by hour with configurable retention
- DI integration:
builder.Services.AddWimaLogger()for ASP.NET / Generic Host - AOT compatible: Trim-safe, AOT-compatible on .NET 10
Installation / 安装
dotnet add package Wima.Log --version 1.8.2.0
Quick Start / 快速开始
using Wima.Log;
// Basic usage / 基本用法
var logger = new WimaLogger("MyApp", logMode: LogMode.Console | LogMode.Native);
logger.Info("Hello Wima.Log!");
// Log with exception / 带异常日志
try { /* ... */ }
catch (Exception ex) { logger.Error("Something failed", ex); }
Log Modes / 日志模式
LogMode.None // No output / 无输出
LogMode.Console // Console output / 控制台输出
LogMode.Native // File output / 文件输出
LogMode.ElasticSearch // ES output / ES 输出
LogMode.CommonLog // Bridge to Common.Logging / 桥接到 Common.Logging
LogMode.Verbose // Verbose output / 详细输出
LogMode.StackTrace // Stack trace on error / 错误时输出堆栈
// Combine modes / 组合模式
LogMode.Console | LogMode.Native | LogMode.ElasticSearch
DI Integration / 依赖注入
// ASP.NET Core / Generic Host
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddWimaLogger();
// With configuration / 带配置
builder.Services.AddWimaLogger(cfg =>
{
cfg.LogLevel = Common.Logging.LogLevel.Info;
cfg.LogMode = LogMode.Console | LogMode.Native;
});
ElasticSearch / ES 输出
// Initialize ES service / 初始化 ES 服务
WimaLogger.InitESService("http://localhost:9200", "my-index-prefix");
// Logs will auto-index to ES when ElasticSearch mode is enabled
// 启用 ElasticSearch 模式后日志将自动索引到 ES
Log Levels / 日志级别
| Common.Logging | Microsoft.Extensions.Logging |
|---|---|
Trace |
Trace |
Debug |
Debug |
Info |
Information |
Warn |
Warning |
Error |
Error |
Fatal |
Critical |
License / 许可证
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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 is compatible. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Common.Logging (>= 3.4.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging.Configuration (>= 10.0.12)
- Microsoft.Extensions.ObjectPool (>= 10.0.12)
- NEST (>= 7.17.5)
-
net10.0
- Common.Logging (>= 3.4.1)
- NEST (>= 7.17.5)
-
net8.0
- Common.Logging (>= 3.4.1)
- NEST (>= 7.17.5)
-
net9.0
- Common.Logging (>= 3.4.1)
- NEST (>= 7.17.5)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Wima.Log:
| Package | Downloads |
|---|---|
|
Wima.WinForm
Wima通用Winform可复用控件和窗体库 |
|
|
Wima.Opc
Wima通用Opc基础库,提供两个底层Opc框架:hOpc和LibUA的支持,和客户端抽象接口。 |
|
|
Wima.Web.Engine
Wima通用Web引擎库,支持Kestrel和超轻量级Nhttp(1.1+SSL) |
|
|
Puppet.Core
Puppet.Core 框架:为任意 .NET 类型(含 WinForm 窗体)提供 AI Agent 可操控的 WebApi 接口,通过反射自动生成能力描述,支持运行时状态查询与方法调用。 |
GitHub repositories
This package is not used by any popular GitHub repositories.