CBLibrary.Log
1.1.1
dotnet add package CBLibrary.Log --version 1.1.1
NuGet\Install-Package CBLibrary.Log -Version 1.1.1
<PackageReference Include="CBLibrary.Log" Version="1.1.1" />
paket add CBLibrary.Log --version 1.1.1
#r "nuget: CBLibrary.Log, 1.1.1"
// Install CBLibrary.Log as a Cake Addin #addin nuget:?package=CBLibrary.Log&version=1.1.1 // Install CBLibrary.Log as a Cake Tool #tool nuget:?package=CBLibrary.Log&version=1.1.1
日志记录组件(CBLibrary.Log) 1.1.1 Release Notes
Welcome to the release notes for CBLibrary.Log 1.1.1
What's features in 1.1.1
LogHelper:提供 Debug Info Warn Error Fatal 级别日志记录方法
Log4netProvider:基于log4net封装
NLogProvider:基于nlog封装
日志文件按级别分文件夹保存,保存路径可以通过log4net.config配置文件自定义,如下:
<file value="logs/info/"/>
Usages
配置文件
将packages/CBLibrary.Log/configs文件夹复制到项目根目录,并设置log4net.config文件:复制到输出目录 --> 如果较新则复制
web.config 或 app.config 添加以下配置(若已添加请忽略该步骤) <configuration> <appSettings>
<add key="logProviderName" value="log4net"/> <add key="logConfigFile" value="configs\log4net.config"/>
</appSettings> </configuration>
Debug
- 方法签名 public static void Debug(object source, string message, Exception exception = null)
- 调用示例 LogHelper.Debug(this, "DebugTest");
Info
- 方法签名 public static void Info(object source, string message, Exception exception = null)
- 调用示例 LogHelper.Info(this, "InfoTest");
Warn
- 方法签名 public static void Warn(object source, string message, Exception exception = null)
- 调用示例 LogHelper.Warn(this, "WarningTest");
Error
- 方法签名 public static void Error(object source, string message, Exception exception = null)
- 调用示例 LogHelper.Error(this, "ErrorTest");
Fatal
- 方法签名 public static void Fatal(object source, string message, Exception exception = null)
- 调用示例 LogHelper.Fatal(this, "FatalTest", new ArgumentException());
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- log4net (>= 2.0.8)
- NLog (>= 4.7.5)
- NLog.Config (>= 4.7.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CBLibrary.Log:
Package | Downloads |
---|---|
CBLibrary.Data
Dapper操作MSSQL或MySQL常用方法封装, 支持异步、事务及批量导入, 具体使用方法请参阅README.md说明或者联系作者 |
GitHub repositories
This package is not used by any popular GitHub repositories.
新增NLogProvider,基于nlog封装