Fix #3625: add the clear logs function.

This commit is contained in:
Ben
2024-04-03 09:21:13 +08:00
parent 578b7b0512
commit 4c08a527be
8 changed files with 104 additions and 49 deletions

View File

@ -29,6 +29,13 @@ namespace Oqtane.Services
/// <returns></returns>
Task<Log> GetLogAsync(int logId);
/// <summary>
/// Clear the entire logs of the given site.
/// </summary>
/// <param name="siteId"></param>
/// <returns></returns>
Task ClearLogsAsync(int siteId);
/// <summary>
/// Creates a new log entry
/// </summary>

View File

@ -35,6 +35,11 @@ namespace Oqtane.Services
return await GetJsonAsync<Log>($"{Apiurl}/{logId}");
}
public async Task ClearLogsAsync(int siteId)
{
await DeleteAsync($"{Apiurl}?siteid={siteId}&includeErrors=true");
}
public async Task Log(int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args)
{
await Log(null, pageId, moduleId, userId, category, feature, function, level, exception, message, args);