mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-15 15:57:54 +02:00
API GET LogMessages new optional parameter count
This commit is contained in:
@ -419,7 +419,20 @@ public class Server : GlobalBase
|
|||||||
SendResponse(HttpStatusCode.NotFound, response);
|
SendResponse(HttpStatusCode.NotFound, response);
|
||||||
break;
|
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;
|
break;
|
||||||
case "LogFile":
|
case "LogFile":
|
||||||
if (logger is null || !File.Exists(logger?.logFilePath))
|
if (logger is null || !File.Exists(logger?.logFilePath))
|
||||||
|
Reference in New Issue
Block a user