mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
Compare commits
3 Commits
10.11.101.
...
c0337e2b19
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c0337e2b19 | ||
![]() |
8a95f48f5a | ||
![]() |
14f3c31265 |
@@ -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}");
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.2.7" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
<PackageReference Include="BootstrapBlazor" Version="9.11.1" />
|
||||
<PackageReference Include="BootstrapBlazor" Version="9.11.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using ThingsGateway.NewLife.Threading;
|
||||
namespace ThingsGateway.NewLife;
|
||||
@@ -51,18 +52,20 @@ public class ExpiringDictionary<TKey, TValue> : IDisposable
|
||||
return rs;
|
||||
}
|
||||
}
|
||||
private ConcurrentDictionary<TKey, CacheItem> _dict;
|
||||
|
||||
private ConcurrentDictionary<TKey, CacheItem> _dict = new();
|
||||
private readonly TimerX _cleanupTimer;
|
||||
private int defaultExpire = 60;
|
||||
public ExpiringDictionary(int expire = 60)
|
||||
IEqualityComparer<TKey>? comparer;
|
||||
public ExpiringDictionary(int expire = 60, IEqualityComparer<TKey>? comparer = null)
|
||||
{
|
||||
defaultExpire = expire;
|
||||
this.comparer = comparer;
|
||||
_dict = new ConcurrentDictionary<TKey, CacheItem>(comparer);
|
||||
|
||||
_cleanupTimer = new TimerX(TimerClear, null, 10000, 10000) { Async = true };
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool TryAdd(TKey key, TValue value)
|
||||
{
|
||||
if (_dict.TryGetValue(key, out var item))
|
||||
@@ -109,7 +112,7 @@ public class ExpiringDictionary<TKey, TValue> : IDisposable
|
||||
private void Clear(object? state)
|
||||
{
|
||||
var data = _dict;
|
||||
_dict = new();
|
||||
_dict = new(comparer);
|
||||
data.Clear();
|
||||
}
|
||||
private void TimerClear(object? state)
|
||||
@@ -143,3 +146,4 @@ public class ExpiringDictionary<TKey, TValue> : IDisposable
|
||||
_cleanupTimer.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net462;netstandard2.0;net6.0;net6.0-windows;net8.0;$(OtherTargetFrameworks);net8.0-windows;</TargetFrameworks>
|
||||
<TargetFrameworks>net47;netstandard2.0;net6.0;net6.0-windows;net8.0;$(OtherTargetFrameworks);net8.0-windows;</TargetFrameworks>
|
||||
<AssemblyName>ThingsGateway.NewLife.X</AssemblyName>
|
||||
<RootNamespace>ThingsGateway.NewLife</RootNamespace>
|
||||
<AssemblyTitle>工具核心库</AssemblyTitle>
|
||||
@@ -35,12 +35,11 @@
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
|
||||
<PackageReference Include="System.Memory" Version="4.6.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net47'">
|
||||
<PackageReference Include="System.Memory" Version="4.6.3" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.6.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net47'">
|
||||
<Using Include="System.Net.Http" />
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="System.Management" />
|
||||
|
@@ -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());
|
||||
|
@@ -31,7 +31,7 @@
|
||||
<PackageReference Include="Npgsql" Version="9.0.4" />
|
||||
<PackageReference Include="CsvHelper" Version="33.1.0" />
|
||||
<PackageReference Include="TDengine.Connector" Version="3.1.9" />
|
||||
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.9.1" />
|
||||
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.26.0" />
|
||||
<PackageReference Include="Oscar.Data.SqlClient" Version="4.2.28" />
|
||||
<PackageReference Include="System.Data.Common" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.2" />
|
||||
|
@@ -1,13 +1,13 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.11.101</PluginVersion>
|
||||
<ProPluginVersion>10.11.101</ProPluginVersion>
|
||||
<DefaultVersion>10.11.101</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.20</NET8Version>
|
||||
<NET10Version>10.0.0-rc.1.25451.107</NET10Version>
|
||||
<NET8Version>8.0.21</NET8Version>
|
||||
<NET10Version>10.0.0-rc.2.25502.107</NET10Version>
|
||||
<SatelliteResourceLanguages>zh-Hans;en-US</SatelliteResourceLanguages>
|
||||
<IsTrimmable>false</IsTrimmable>
|
||||
<ManagementProPluginVersion>10.11.87</ManagementProPluginVersion>
|
||||
|
@@ -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);
|
||||
|
@@ -57,7 +57,7 @@ public partial class VariableRow : IDisposable
|
||||
/// <param name="col"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
protected RenderFragment GetValue(ITableColumn col, VariableRuntime item) => builder =>
|
||||
protected static RenderFragment GetValue(ITableColumn col, VariableRuntime item) => builder =>
|
||||
{
|
||||
if (col.Template != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user