From ef3084af91c30f09cb1f796e64d7a8b28e964f44 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 30 Apr 2026 18:26:49 +0200 Subject: [PATCH] aggiunto log x input lento (>15ms...) --- MP.IOC/Controllers/IOBController.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/MP.IOC/Controllers/IOBController.cs b/MP.IOC/Controllers/IOBController.cs index a15d6427..9d5bed28 100644 --- a/MP.IOC/Controllers/IOBController.cs +++ b/MP.IOC/Controllers/IOBController.cs @@ -6,6 +6,7 @@ using MP.Data.Services.IOC; using MP.IOC.Data; using Newtonsoft.Json; using NLog; +using System.Diagnostics; using System.Reflection; using static MP.Core.Objects.Enums; @@ -874,16 +875,23 @@ namespace MP.IOC.Controllers if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID"); string answ = ""; - if (string.IsNullOrEmpty(cnt)) - { - cnt = "0"; - } + cnt = string.IsNullOrEmpty(cnt) ? "0" : cnt; - DateTime dataOraEvento = DateTime.Now; try { + Stopwatch sw = new Stopwatch(); + sw.Start(); answ = await IOCService.ProcessInputAsync(id, valore, dtEve, dtCurr, cnt); //answ = await DService.ProcessInputAsync(id, valore, dtEve, dtCurr, cnt); + sw.Stop(); + if (sw.Elapsed.TotalMilliseconds > 15) + { + Log.Info($"Input | elapsed: {sw.Elapsed.TotalMilliseconds:N1} | id: {id} | val: {valore} | cnt: {cnt}"); + } + else + { + Log.Debug($"Input | elapsed: {sw.Elapsed.TotalMilliseconds:N1} | id: {id} | val: {valore} | cnt: {cnt}"); + } return Ok(answ); } catch (Exception exc)