TencentCloudLogger 0.0.7

dotnet add package TencentCloudLogger --version 0.0.7                
NuGet\Install-Package TencentCloudLogger -Version 0.0.7                
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="TencentCloudLogger" Version="0.0.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TencentCloudLogger --version 0.0.7                
#r "nuget: TencentCloudLogger, 0.0.7"                
#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 TencentCloudLogger as a Cake Addin
#addin nuget:?package=TencentCloudLogger&version=0.0.7

// Install TencentCloudLogger as a Cake Tool
#tool nuget:?package=TencentCloudLogger&version=0.0.7                

TencentCloudLogger

注意

  1. 该项目封装的是 2017 版的 API,非最新的 3.0 版 API,官方地址:https://cloud.tencent.com/document/api/614/16873
  2. 2017 版 API 官方截至 2022-1-9 给出的地址是 <Region>.cls.tencentyun.com ,经测试容易出现503错误,可使用 <Region>.cls.tencentcs.com 代替。

使用方法

  1. appsettings.json 中添加如下配置项:
{
  "TencentCloudLogger": {
    "Level": "Information",//记录的最低日志级别
    "ApiHost": "http://ap-shanghai.cls.tencentcs.com", //请求地址 
    "SecretId": "AKID....",
    "SecretKey": "sVrw...",
    "Topic": "4807fc45-xxxx-xxxx-xxxxxxxxxxxx" //日志主题ID
  }
}
  1. Startup.cs 文件中 ConfigureServices 方法里依赖注入:
var option = Configuration.GetSection("TencentCloudLogger").Get<TCloudOption>();
services.AddTencentCloudLogger(option);

或者在 Program.cs 文件中 :

var option = builder.Configuration.GetSection("TencentCloudLogger").Get<TCloudOption>();
builder.Services.AddTencentCloudLogger(option);
  1. 调用:
private readonly ILogger _logger;

public Test(ILogger<TCloudLogger> logger)
{
    _logger = logger;
}

_logger.LogInformation("Test");
_logger.LogError("Test");
_logger.LogDebug("Test");
_logger.LogWarning("Test");
...
...
...

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.0.7 509 1/21/2022
0.0.6 272 1/10/2022
0.0.5 321 8/25/2021