1、电梯服务类新增获取电梯状态接口

2、自定义日志记录器代码调整
3、电梯流程新增测试代码
This commit is contained in:
yang.lee
2023-11-24 21:22:26 +08:00
parent e497caf393
commit 1bd3d5a6c2
10 changed files with 230 additions and 72 deletions

View File

@@ -35,9 +35,17 @@ namespace Tnb.WarehouseMgr
public class BaseWareHouseService : IOverideVisualDevService, IDynamicApiController, ITransient
{
private static readonly Lazy<Dictionary<string, IWHStorageService>> _stroageMapLazy;
private static readonly Dictionary<LogLevel, string> s_logLevelMap = new()
{
[LogLevel.Debug] = "DBG",
[LogLevel.Information] = "INF",
[LogLevel.Warning] = "WRN",
[LogLevel.Error] = "ERR",
};
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public static SemaphoreSlim s_taskExecuteSemaphore = new(1);
protected IEventPublisher? EventPublisher { set; get; }
protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/custom{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
@@ -46,9 +54,9 @@ namespace Tnb.WarehouseMgr
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
cfgOpts.MessageFormat = (logMsg) =>
{
Span<char> span = logMsg.LogLevel.ToString().ToCharArray();
StringBuilder sb = new();
_ = sb.Append($"{span[..4]} ");
var logLevel = s_logLevelMap[logMsg.LogLevel];
var sb = new StringBuilder();
_ = sb.Append($"[{logLevel}] ");
_ = sb.Append($"{logMsg.LogName} ");
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
_ = sb.Append($"#{logMsg.EventId.Id} ");