Medcare.Extensions.Logging.MdcLog 0.1.0-beta

This is a prerelease version of Medcare.Extensions.Logging.MdcLog.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Medcare.Extensions.Logging.MdcLog --version 0.1.0-beta
                    
NuGet\Install-Package Medcare.Extensions.Logging.MdcLog -Version 0.1.0-beta
                    
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="Medcare.Extensions.Logging.MdcLog" Version="0.1.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Medcare.Extensions.Logging.MdcLog" Version="0.1.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="Medcare.Extensions.Logging.MdcLog" />
                    
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 Medcare.Extensions.Logging.MdcLog --version 0.1.0-beta
                    
#r "nuget: Medcare.Extensions.Logging.MdcLog, 0.1.0-beta"
                    
#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 Medcare.Extensions.Logging.MdcLog@0.1.0-beta
                    
#: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=Medcare.Extensions.Logging.MdcLog&version=0.1.0-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Medcare.Extensions.Logging.MdcLog&version=0.1.0-beta&prerelease
                    
Install as a Cake Tool

Microsoft.Extensions.Logging.MdcLog

Microsoft.Extensions.Logging.MdcLog 是一个日志库,继承自 Microsoft.Extensions.Logging,用于在 .NET 8 项目中记录日志到单独的文件,并支持将日志上传到独立的 Web API 接口。

功能特性

  • 记录日志到指定文件。
  • 上传日志到指定的 Web API 接口。

使用方法

安装

在项目中安装 Microsoft.Extensions.Logging.MdcLog NuGet 包。

配置

在 Program.cs 中添加以下代码:

var builder = WebApplication.CreateBuilder(args);
// 方式1:默认日志级别为 Information,并且仅记录本地日志
//builder.Logging.AddMdcLogger();
// 方式1:默认日志级别为 Debug,并且仅记录本地日志
//builder.Logging.AddMdcLogger(LogLevel.Debug);
// 方式1:默认日志级别为 Information,并且上报到指定的 Web API 地址(仅警告级别+)
builder.Logging.AddMdcLogger(LogLevel.Information, new MdcLogOption
{
    CustomAppName = "测试程序",
    Department = "消化内科",
    LogApiUrl = "http://192.168.2.6:20237/api/log",
    LogApiLevel = LogLevel.Warning
});
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.

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