From 88977f8c0ff336ab9030d5515ebb519fc4d97c4f Mon Sep 17 00:00:00 2001 From: "nodyang@aliyun.com" Date: Mon, 23 Sep 2024 14:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E6=8F=8F=E6=95=B0=E6=8D=AE=E5=9B=9E?= =?UTF-8?q?=E4=BC=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.TouchSocket/ApiServer.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 = "";