diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs index a2268d4..459913f 100644 --- a/SlnMesnac.TouchSocket/ApiServer.cs +++ b/SlnMesnac.TouchSocket/ApiServer.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Extensions.Logging; using SlnMesnac.Model.domain; using SlnMesnac.Repository.service; using SlnMesnac.Repository.service.LogImpl; @@ -18,17 +19,20 @@ namespace SlnMesnac.TouchSocket private readonly IBaseCodeService _baseCodeService; - IBaseLogService _baseLogService; + readonly IBaseLogService _baseLogService; public Action? ScanLogSocketAction; public Action? ScanStatusSocketAction; + private ILogger _logger; - public ApiServer(IScanLogService scanService, IBaseCodeService baseCodeService, IBaseLogService baseLogService) + + public ApiServer(IScanLogService scanService, IBaseCodeService baseCodeService, IBaseLogService baseLogService, ILogger logger) { _scanService = scanService; _baseCodeService = baseCodeService; _baseLogService = baseLogService; + _logger=logger; } /// @@ -40,6 +44,8 @@ namespace SlnMesnac.TouchSocket [WebApi(HttpMethodType.POST)] public Back ScanStatus(ScanStatusSocket scanStatus) { + _logger.LogInformation("扫描的状态接口"); + _logger.LogInformation("{Data}",scanStatus.ToJsonString()); BaseLog log = new BaseLog { LogLevel = "Info", @@ -88,6 +94,10 @@ namespace SlnMesnac.TouchSocket [WebApi(HttpMethodType.POST)] public Back ScanBack(ScanLogSocket scanLog) { + + _logger.LogInformation("扫描数据回传接口"); + _logger.LogInformation("{Data}", scanLog.ToJsonString()); + BaseLog log = new BaseLog(); log.LogLevel = "Info"; log.ErrMsg = "";