日志统一采用微软
This commit is contained in:
@@ -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());
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
|
//"Default": "Debug",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
|
//"Default": "Debug",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
|
//"Default": "Debug",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user