CVSolution.NLogExtension
1.0.0-pre6
This is a prerelease version of CVSolution.NLogExtension.
dotnet add package CVSolution.NLogExtension --version 1.0.0-pre6
NuGet\Install-Package CVSolution.NLogExtension -Version 1.0.0-pre6
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="CVSolution.NLogExtension" Version="1.0.0-pre6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CVSolution.NLogExtension" Version="1.0.0-pre6" />
<PackageReference Include="CVSolution.NLogExtension" />
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 CVSolution.NLogExtension --version 1.0.0-pre6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CVSolution.NLogExtension, 1.0.0-pre6"
#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 CVSolution.NLogExtension@1.0.0-pre6
#: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=CVSolution.NLogExtension&version=1.0.0-pre6&prerelease
#tool nuget:?package=CVSolution.NLogExtension&version=1.0.0-pre6&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CVSolution.NLogExtension
介绍
NLog扩展
使用说明
- IOC注入
using CVSolution;
using CVSolution.NLogExtension.Works;
using CVSolution.NLogExtension;
private AppConfig appConfig;
public void ConfigureServices(IServiceCollection services)
{
appConfig = ConfigTool.Instance.AddJsonFile<AppConfig>("AppConfig", false, true);
services.AddNLog(appConfig.NLogConfig);
services.AddHostedService<AutoDelLog>(); // 自动清理日志
}
- AppConfig类属性
using CVSolution.NLogExtension;
public class AppConfig
{
public NLogConfig NLogConfig { get; set; }
}
- Json配置内容
{
"NLogConfig": {
"Path": "Log", // 日志存放位置(相对路径)
"ConfigFilePath": "Configs/NLog.config", // NLog.config路径(相对路径)
"FileName": "${level}-${shortdate}-${date:format=HH}", // 文件名称,不需要写后缀,默认为txt
"ArchiveAboveSize": 300, // 单个日志文件最大大小 单位:KB
"SaveDayLog": 5, // 日志保存时间(单位:天)
"IsDefaultLog": true // 是否加载默认日志标签(mainLog, otherLog)
}
}
- NLog.config配置内容
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwConfigExceptions="true">
<targets async="true">
<target name="colorConsole" xsi:type="ColoredConsole" layout="[${shortdate} ${date:format=HH\:mm\:ss.fff}]:${message}${newline}" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="colorConsole" />
</rules>
</nlog>
- 相关方法(有空在写)
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 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. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- CVSolution (>= 1.0.0-pre7)
- NLog (>= 5.2.3)
- NLog.Web.AspNetCore (>= 5.3.3)
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 |
---|---|---|
1.0.0-pre6 | 112 | 2/2/2024 |
1.0.0-pre5 | 93 | 4/16/2024 |
1.0.0-pre4 | 85 | 4/16/2024 |
1.0.0-pre3 | 177 | 12/1/2023 |
1.0.0-pre2 | 100 | 9/21/2023 |
1.0.0-pre1 | 84 | 4/16/2024 |