日志统一采用微软

This commit is contained in:
陈淳
2023-02-07 10:50:37 +08:00
parent fdd1eda9ec
commit 5867559502
6 changed files with 12 additions and 20 deletions

View File

@@ -94,8 +94,6 @@ namespace Yi.Framework.Core.Sqlsugar.Extensions
}; };
db.Aop.OnLogExecuting = (s, p) => db.Aop.OnLogExecuting = (s, p) =>
{
if (GobalLogModel.SqlLogEnable)
{ {
var _logger = ServiceLocatorModel.Instance?.GetRequiredService<ILogger<SqlSugarClient>>(); var _logger = ServiceLocatorModel.Instance?.GetRequiredService<ILogger<SqlSugarClient>>();
@@ -106,8 +104,7 @@ namespace Yi.Framework.Core.Sqlsugar.Extensions
sb.Append($"\r\n参数:{i.ParameterName},参数值:{i.Value}"); sb.Append($"\r\n参数:{i.ParameterName},参数值:{i.Value}");
} }
sb.Append($"\r\n 完整SQL{UtilMethods.GetSqlString(DbType.MySql, s, p)}"); sb.Append($"\r\n 完整SQL{UtilMethods.GetSqlString(DbType.MySql, s, p)}");
_logger?.LogInformation(sb.ToString()); _logger?.LogDebug(sb.ToString());
}
}; };
}); });

View File

@@ -6,10 +6,4 @@ using System.Threading.Tasks;
namespace Yi.Framework.Core.Model namespace Yi.Framework.Core.Model
{ {
public class GobalLogModel
{
public static bool SqlLogEnable { get; set; } = true;
public static bool LoginCodeEnable { get; set; } = true;
}
} }

View File

@@ -35,9 +35,7 @@ namespace Yi.Framework.Core
services.AddAutoIocServer(); services.AddAutoIocServer();
services.AddCurrentUserServer(); services.AddCurrentUserServer();
//全局日志
GobalLogModel.SqlLogEnable = Appsettings.appBool("SqlLog_Enable");
GobalLogModel.LoginCodeEnable = Appsettings.appBool("LoginCode_Enable");
} }
} }
} }

View File

@@ -2,6 +2,7 @@
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
//"Default": "Debug",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },

View File

@@ -2,6 +2,7 @@
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
//"Default": "Debug",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },

View File

@@ -2,6 +2,7 @@
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
//"Default": "Debug",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },