mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-19 16:06:36 +08:00
feat:添加日志模块
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
using AspNetCore.Microsoft.AspNetCore.Hosting;
|
||||
using NLog;
|
||||
using NLog.Extensions.Logging;
|
||||
using Yi.Framework.Core.Autofac.Extensions;
|
||||
using Yi.Framework.Core.Autofac.Modules;
|
||||
using Yi.Framework.Core.Extensions;
|
||||
using Yi.Framework.Core.Module;
|
||||
using Yi.Template.Application;
|
||||
using Yi.Template.Web;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
//配置日志
|
||||
builder.Services.AddLogging(builder => { builder.ClearProviders().AddNLog("nlog.config").SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); });
|
||||
Logger? _logger = LogManager.Setup().LoadConfigurationFromAssemblyResource(typeof(Program).Assembly).GetCurrentClassLogger();
|
||||
_logger.Info("-----( ¯ □ ¯ )YiFrameowrk框架启动-----");
|
||||
//设置启动url
|
||||
builder.WebHost.UseStartUrlsServer(builder.Configuration);
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
<ProjectReference Include="..\Yi.Template.Sqlsugar\Yi.Template.Sqlsugar.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="nlog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="key.pem">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
|
||||
Reference in New Issue
Block a user