2
0

API GET LogMessages new optional parameter count

This commit is contained in:
glax 2023-09-13 14:40:23 +02:00
parent 28fa85f05c
commit a4a49d40f0

View File

@ -419,7 +419,20 @@ public class Server : GlobalBase
SendResponse(HttpStatusCode.NotFound, response);
break;
}
SendResponse(HttpStatusCode.OK, response, logger.GetLog());
if (requestVariables.TryGetValue("count", out string? count))
{
try
{
uint messageCount = uint.Parse(count);
SendResponse(HttpStatusCode.OK, response, logger.Tail(messageCount));
}
catch (FormatException f)
{
SendResponse(HttpStatusCode.InternalServerError, response, f);
}
}else
SendResponse(HttpStatusCode.OK, response, logger.GetLog());
break;
case "LogFile":
if (logger is null || !File.Exists(logger?.logFilePath))