aggiunto log x input lento (>15ms...)

This commit is contained in:
Samuele Locatelli
2026-04-30 18:26:49 +02:00
parent e66e4f898f
commit ef3084af91
+13 -5
View File
@@ -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)