Skip to content

Latest commit

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Logging

项目层次说明

Overt.Core.Logging v1.0.2

1. 项目目录

|-dllconfigs 配置文件保存
||-Exless Exceptionless
|-|-ExlessLogger.cs 实现ILogger
|-|-ExlessLoggerProvider.cs 实现ILoggerProvider
||-NLog NLog
|-|-NLogOptions.cs NLog配置注入类
||-ServiceCollectionExtensions.cs netcore注入

2. 版本及支持

  • Nuget版本:V 1.0.2
  • 框架支持: netcoreapp2.2

3. 项目依赖

  • netcoreapp2.2
NLog.Extensions.Logging 1.2.1System.Data.SqlClient 4.4.0Exceptionless.AspNetCore 4.3.2012Microsoft.Extensions.DependencyInjection 2.2.0Microsoft.Extensions.Logging2.2.0

使用

1. Nuget包引用

Install-Package Overt.Core.Logging-Version 1.0.2

2. 使用

(1)NLog
  • 添加配置文件 /dllconfigs/Overt.Core.Logging.dll.config
  • 代码中使用
// ConsoleApplicationvarhost=newHostBuilder().ConfigureLogging(ConfigureLogging)//注入日志组件.ConfigureServices(ConfigureServices)//提供通用注入配置.Build();host.Run();/// <summary>/// 添加ILoggerProvider/// </summary>/// <param name="context"></param>/// <param name="loggingBuilder"></param>privatestaticvoidConfigureLogging(HostBuilderContextcontext,ILoggingBuilderloggingBuilder){loggingBuilder.AddConfiguration(context.Configuration.GetSection("Logging"));loggingBuilder.AddNLogLogging();}// WebApplicationpublicvoidConfigureServices(IServiceCollectionservices){services.AddMvc();services.AddNLogLogging();}

(2)Exceptionless
  • 配置文件中添加Exceptionless节点
"Exceptionless":{"ServerUrl":"exless服务地址","ApiKey":"项目apikey""Tags":"自定义标签"}
  • 代码中使用
// ConsoleApplicationvarhost=newHostBuilder().Build();host.Services.AddExlessLogging();host.Run();// WebApplicationpublicvoidConfigure(IApplicationBuilderapp,IHostingEnvironmentenv){app.AddExlessLogging();}

About

支持Exceptionless

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages