调整日志
This commit is contained in:
parent
e37939e82b
commit
578f73a23a
|
|
@ -24,7 +24,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\html\" />
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -127,9 +127,10 @@ public static class Program
|
|||
{
|
||||
//获取作IOC作用域对象
|
||||
var appServive = s.GetService<IHttpContextAccessor>();
|
||||
var log = s.GetService<Serilog.ILogger>();
|
||||
// var obj = appServive?.HttpContext?.RequestServices.GetService<Log>();
|
||||
// Console.WriteLine("AOP" + obj.GetHashCode());
|
||||
Console.WriteLine($"{appServive?.HttpContext?.Request.Path}:{sql}\r\n{pars}");
|
||||
log?.Debug($"{appServive?.HttpContext?.Request.Path}:{sql}\r\n{pars}");
|
||||
};
|
||||
});
|
||||
sqlSugar.DbMaintenance.CreateDatabase();
|
||||
|
|
@ -149,40 +150,48 @@ public static class Program
|
|||
{
|
||||
foreach (var file in files)
|
||||
{
|
||||
Log.Logger.Information($"Load file -> {file}...");
|
||||
var assembly = Assembly.LoadFile(file);
|
||||
var types = assembly.GetTypes();
|
||||
// bool isUseController = false;
|
||||
foreach (var type in types)
|
||||
try
|
||||
{
|
||||
// Console.WriteLine(type);
|
||||
if (type.IsClass && !type.IsAbstract)
|
||||
Log.Logger.Information($"Load file -> {file}...");
|
||||
var assembly = Assembly.LoadFile(file);
|
||||
var types = assembly.GetTypes();
|
||||
// bool isUseController = false;
|
||||
foreach (var type in types)
|
||||
{
|
||||
var interfaces = type.GetInterfaces();
|
||||
if (interfaces.Contains(typeof(IModule)))
|
||||
// Console.WriteLine(type);
|
||||
if (type.IsClass && !type.IsAbstract)
|
||||
{
|
||||
Log.Logger.Information($"\tFound IModule -> {type.FullName}");
|
||||
var module = Activator.CreateInstance(type) as IModule;
|
||||
module?.ConfigureModule(services);
|
||||
var interfaces = type.GetInterfaces();
|
||||
if (interfaces.Contains(typeof(IModule)))
|
||||
{
|
||||
Log.Logger.Information($"\tFound IModule -> {type.FullName}");
|
||||
var module = Activator.CreateInstance(type) as IModule;
|
||||
module?.ConfigureModule(services);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (isUseController)
|
||||
// {
|
||||
// Log.Logger.Information($"\tAdd Controllers for {assembly.FullName}");
|
||||
// // 添加Controller
|
||||
// services.AddControllers().AddApplicationPart(assembly);
|
||||
// }
|
||||
Log.Logger.Information("done.\r\n");
|
||||
}
|
||||
// if (isUseController)
|
||||
// {
|
||||
// Log.Logger.Information($"\tAdd Controllers for {assembly.FullName}");
|
||||
// // 添加Controller
|
||||
// services.AddControllers().AddApplicationPart(assembly);
|
||||
// }
|
||||
Log.Logger.Information("done.\r\n");
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Logger.Error(ex, $"Load file -> {file} error.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
throw;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Debug",
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft.AspNetCore.Mvc": "Debug",
|
||||
"Microsoft.AspNetCore.Routing": "Debug",
|
||||
"Microsoft.AspNetCore.Hosting": "Debug"
|
||||
"Microsoft.AspNetCore.Mvc": "Information",
|
||||
"Microsoft.AspNetCore.Routing": "Information",
|
||||
"Microsoft.AspNetCore.Hosting": "Information"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue