build: 10.11.105
feat: json添加AllowNamedFloatingPointLiterals
This commit is contained in:
@@ -251,11 +251,13 @@ public class RequestAuditFilter : IAsyncActionFilter, IOrderedFilter
|
||||
|
||||
if (exception == null)
|
||||
{
|
||||
logger.Log(LogLevel.Information, $"{logData.Method}:{logData.Path}-{logData.Operation}");
|
||||
if (logger.IsEnabled(LogLevel.Information))
|
||||
logger.Log(LogLevel.Information, $"{logData.Method}:{logData.Path}-{logData.Operation}");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Log(LogLevel.Warning, $"{logData.Method}:{logData.Path}-{logData.Operation}{Environment.NewLine}{logData.Exception?.ToSystemTextJsonString()}{Environment.NewLine}{logData.Validation?.ToSystemTextJsonString()}");
|
||||
if (logger.IsEnabled(LogLevel.Warning))
|
||||
logger.Log(LogLevel.Warning, $"{logData.Method}:{logData.Path}-{logData.Operation}{Environment.NewLine}{logData.Exception?.ToSystemTextJsonString()}{Environment.NewLine}{logData.Validation?.ToSystemTextJsonString()}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -66,7 +66,8 @@ internal class JsonStringLocalizer(Assembly assembly, string typeName, string ba
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "{JsonStringLocalizerName} searched for '{Name}' in '{typeName}' with culture '{CultureName}' throw exception.", nameof(JsonStringLocalizer), name, typeName, CultureInfo.CurrentUICulture.Name);
|
||||
if (Logger?.IsEnabled(LogLevel.Error) == true)
|
||||
Logger.LogError(ex, "{JsonStringLocalizerName} searched for '{Name}' in '{typeName}' with culture '{CultureName}' throw exception.", nameof(JsonStringLocalizer), name, typeName, CultureInfo.CurrentUICulture.Name);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -176,7 +177,8 @@ internal class JsonStringLocalizer(Assembly assembly, string typeName, string ba
|
||||
localizationMissingItemHandler.HandleMissingItem(name, typeName, CultureInfo.CurrentUICulture.Name);
|
||||
if (jsonLocalizationOptions.IgnoreLocalizerMissing == false)
|
||||
{
|
||||
Logger.LogInformation("{JsonStringLocalizerName} searched for '{Name}' in '{TypeName}' with culture '{CultureName}' not found.", nameof(JsonStringLocalizer), name, typeName, CultureInfo.CurrentUICulture.Name);
|
||||
if (Logger?.IsEnabled(LogLevel.Information) == true)
|
||||
Logger.LogInformation("{JsonStringLocalizerName} searched for '{Name}' in '{TypeName}' with culture '{CultureName}' not found.", nameof(JsonStringLocalizer), name, typeName, CultureInfo.CurrentUICulture.Name);
|
||||
}
|
||||
_missingManifestCache.TryAdd($"name={name}&culture={CultureInfo.CurrentUICulture.Name}");
|
||||
}
|
||||
|
@@ -295,7 +295,8 @@ internal sealed class EventBusHostedService : BackgroundService
|
||||
, retryAction: (total, times) =>
|
||||
{
|
||||
// 输出重试日志
|
||||
_logger.LogWarning("Retrying {times}/{total} times for {EventId}", times, total, eventSource.EventId);
|
||||
if (_logger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Warning) == true)
|
||||
_logger.LogWarning("Retrying {times}/{total} times for {EventId}", times, total, eventSource.EventId);
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
|
@@ -369,11 +369,13 @@ internal sealed class ScheduleHostedService : BackgroundService
|
||||
// 写入作业执行详细日志
|
||||
if (executionException == null)
|
||||
{
|
||||
jobLogger?.LogInformation("{jobExecutingContext}", jobExecutingContext);
|
||||
if (jobLogger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information) == true)
|
||||
jobLogger?.LogInformation("{jobExecutingContext}", jobExecutingContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
jobLogger?.LogError(executionException, "{jobExecutingContext}", jobExecutingContext);
|
||||
if (jobLogger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error) == true)
|
||||
jobLogger?.LogError(executionException, "{jobExecutingContext}", jobExecutingContext);
|
||||
}
|
||||
|
||||
// 记录作业触发器运行信息
|
||||
|
@@ -251,7 +251,8 @@ public sealed class ProfilerDelegatingHandler(ILogger<Logging> logger, IOptions<
|
||||
// 检查是否配置(注册)了日志程序
|
||||
if (remoteOptions.IsLoggingRegistered)
|
||||
{
|
||||
logger.Log(remoteOptions.ProfilerLogLevel, "{message}", message);
|
||||
if (logger?.IsEnabled(remoteOptions.ProfilerLogLevel) == true)
|
||||
logger.Log(remoteOptions.ProfilerLogLevel, "{message}", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -57,6 +57,7 @@ namespace ThingsGateway.SqlSugar
|
||||
}
|
||||
});
|
||||
|
||||
_systemTextJsonSettings.NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals;
|
||||
_systemTextJsonSettings.Converters.Add(new JTokenSystemTextJsonConverter());
|
||||
_systemTextJsonSettings.Converters.Add(new JValueSystemTextJsonConverter());
|
||||
_systemTextJsonSettings.Converters.Add(new JObjectSystemTextJsonConverter());
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.11.104</PluginVersion>
|
||||
<ProPluginVersion>10.11.104</ProPluginVersion>
|
||||
<DefaultVersion>10.11.104</DefaultVersion>
|
||||
<PluginVersion>10.11.105</PluginVersion>
|
||||
<ProPluginVersion>10.11.105</ProPluginVersion>
|
||||
<DefaultVersion>10.11.105</DefaultVersion>
|
||||
<AuthenticationVersion>10.11.6</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.11.6</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.21</NET8Version>
|
||||
|
@@ -117,6 +117,7 @@ public partial class ManagementTask : AsyncDisposableObject
|
||||
{
|
||||
b.UseSystemTextJson(json =>
|
||||
{
|
||||
json.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals;
|
||||
json.Converters.Add(new ByteArrayToNumberArrayConverterSystemTextJson());
|
||||
json.Converters.Add(new JTokenSystemTextJsonConverter());
|
||||
json.Converters.Add(new JValueSystemTextJsonConverter());
|
||||
@@ -180,6 +181,7 @@ public partial class ManagementTask : AsyncDisposableObject
|
||||
{
|
||||
b.UseSystemTextJson(json =>
|
||||
{
|
||||
json.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals;
|
||||
json.Converters.Add(new ByteArrayToNumberArrayConverterSystemTextJson());
|
||||
json.Converters.Add(new JTokenSystemTextJsonConverter());
|
||||
json.Converters.Add(new JValueSystemTextJsonConverter());
|
||||
|
@@ -350,6 +350,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
|
||||
{
|
||||
b.UseSystemTextJson(json =>
|
||||
{
|
||||
json.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals;
|
||||
json.Converters.Add(new ByteArrayToNumberArrayConverterSystemTextJson());
|
||||
json.Converters.Add(new JTokenSystemTextJsonConverter());
|
||||
json.Converters.Add(new JValueSystemTextJsonConverter());
|
||||
@@ -394,6 +395,9 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
|
||||
{
|
||||
b.UseSystemTextJson(json =>
|
||||
{
|
||||
|
||||
|
||||
json.NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals;
|
||||
json.Converters.Add(new ByteArrayToNumberArrayConverterSystemTextJson());
|
||||
json.Converters.Add(new JTokenSystemTextJsonConverter());
|
||||
json.Converters.Add(new JValueSystemTextJsonConverter());
|
||||
|
@@ -136,7 +136,8 @@ internal sealed class PluginService : IPluginService
|
||||
if (driverType != null)
|
||||
{
|
||||
var driver = (DriverBase)Activator.CreateInstance(driverType);
|
||||
_logger?.LogInformation(string.Format(AppResource.LoadTypeSuccess, pluginName));
|
||||
if (_logger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information) == true)
|
||||
_logger?.LogInformation(string.Format(AppResource.LoadTypeSuccess, pluginName));
|
||||
_driverBaseDict.TryAdd(pluginName, driverType);
|
||||
return driver;
|
||||
}
|
||||
@@ -440,7 +441,8 @@ internal sealed class PluginService : IPluginService
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 加载失败时记录警告信息
|
||||
_logger?.LogWarning(ex, string.Format(AppResource.LoadOtherFileFail, item));
|
||||
if (_logger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Warning) == true)
|
||||
_logger?.LogWarning(ex, string.Format(AppResource.LoadOtherFileFail, item));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -679,7 +681,8 @@ internal sealed class PluginService : IPluginService
|
||||
}
|
||||
//添加到全局对象
|
||||
_assemblyLoadContextDict.TryAdd(fileName, (assemblyLoadContext, assembly));
|
||||
_logger?.LogInformation(string.Format(AppResource.AddPluginFile, path));
|
||||
if (_logger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information) == true)
|
||||
_logger?.LogInformation(string.Format(AppResource.AddPluginFile, path));
|
||||
}
|
||||
return assembly;
|
||||
}
|
||||
@@ -728,7 +731,8 @@ internal sealed class PluginService : IPluginService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger?.LogWarning(ex, string.Format(AppResource.LoadOtherFileFail, item));
|
||||
if (_logger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Warning) == true)
|
||||
_logger?.LogWarning(ex, string.Format(AppResource.LoadOtherFileFail, item));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -827,7 +831,8 @@ internal sealed class PluginService : IPluginService
|
||||
{
|
||||
//添加到字典
|
||||
_driverBaseDict.TryAdd($"{driverMainName}.{type.Name}", type);
|
||||
_logger?.LogInformation(string.Format(AppResource.LoadTypeSuccess, PluginInfoUtil.GetFullName(driverMainName, type.Name)));
|
||||
if (_logger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information) == true)
|
||||
_logger?.LogInformation(string.Format(AppResource.LoadTypeSuccess, PluginInfoUtil.GetFullName(driverMainName, type.Name)));
|
||||
}
|
||||
var plugin = new PluginInfo()
|
||||
{
|
||||
@@ -847,7 +852,8 @@ internal sealed class PluginService : IPluginService
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录加载插件失败的日志
|
||||
_logger?.LogWarning(ex, string.Format(AppResource.LoadPluginFail, Path.GetRelativePath(AppContext.BaseDirectory.CombinePathWithOs(tempDir), folderPath)));
|
||||
if (_logger?.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Warning) == true)
|
||||
_logger?.LogWarning(ex, string.Format(AppResource.LoadPluginFail, Path.GetRelativePath(AppContext.BaseDirectory.CombinePathWithOs(tempDir), folderPath)));
|
||||
}
|
||||
}
|
||||
return plugins.DistinctBy(a => a.FullName).OrderBy(a => a.EducationPlugin);
|
||||
|
Reference in New Issue
Block a user