CBLibrary.Log 1.1.1

dotnet add package CBLibrary.Log --version 1.1.1
NuGet\Install-Package CBLibrary.Log -Version 1.1.1
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="CBLibrary.Log" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CBLibrary.Log --version 1.1.1
#r "nuget: CBLibrary.Log, 1.1.1"
#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.
// 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

配置文件
  1. 将packages/CBLibrary.Log/configs文件夹复制到项目根目录,并设置log4net.config文件:复制到输出目录 --> 如果较新则复制

  2. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last updated
1.1.1 536 11/3/2020
1.1.0 451 11/2/2020
1.0.0 1,502 4/24/2017

新增NLogProvider,基于nlog封装