move logging from Html/Text controller to Server Service class so that is captured in all render modes

This commit is contained in:
sbwalker
2024-03-21 15:19:30 -04:00
parent ec7bd8c1c8
commit e0ef3ca39a
2 changed files with 13 additions and 18 deletions

View File

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Oqtane.Modules.HtmlText.Repository;
using Microsoft.AspNetCore.Http;
using Oqtane.Shared;
using Oqtane.Enums;
@ -9,7 +8,6 @@ using Oqtane.Controllers;
using System.Net;
using Oqtane.Documentation;
using System.Collections.Generic;
using System.Linq;
using Oqtane.Modules.HtmlText.Services;
using System.Threading.Tasks;
@ -84,9 +82,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
{
if (ModelState.IsValid && IsAuthorizedEntityId(EntityNames.Module, htmlText.ModuleId))
{
htmlText = await _htmlTextService.AddHtmlTextAsync(htmlText);
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Html/Text Added {HtmlText}", htmlText);
return htmlText;
return await _htmlTextService.AddHtmlTextAsync(htmlText);
}
else
{
@ -104,7 +100,6 @@ namespace Oqtane.Modules.HtmlText.Controllers
if (IsAuthorizedEntityId(EntityNames.Module, moduleId))
{
await _htmlTextService.DeleteHtmlTextAsync(id, moduleId);
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Html/Text Deleted {HtmlTextId}", id);
}
else
{