Remove LogWarning<T> from LoggerExtensions

This commit is contained in:
Nikolaj
2020-09-16 09:58:07 +02:00
parent dda6fb12a3
commit 488093add3
56 changed files with 105 additions and 155 deletions

View File

@@ -357,13 +357,13 @@ namespace Umbraco.Web.BackOffice.Controllers
var unlockResult = await _userManager.SetLockoutEndDateAsync(identityUser, DateTimeOffset.Now);
if (unlockResult.Succeeded == false)
{
_logger.LogWarning<AuthenticationController>("Could not unlock for user {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First().Description);
_logger.LogWarning("Could not unlock for user {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First().Description);
}
var resetAccessFailedCountResult = await _userManager.ResetAccessFailedCountAsync(identityUser);
if (resetAccessFailedCountResult.Succeeded == false)
{
_logger.LogWarning<AuthenticationController>("Could not reset access failed count {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First().Description);
_logger.LogWarning("Could not reset access failed count {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First().Description);
}
}

View File

@@ -80,7 +80,7 @@ namespace Umbraco.Web.BackOffice.Controllers
{
var viewPath = Path.Combine(_globalSettings.UmbracoPath , Constants.Web.Mvc.BackOfficeArea, nameof(Default) + ".cshtml")
.Replace("\\", "/"); // convert to forward slashes since it's a virtual path
return await RenderDefaultOrProcessExternalLoginAsync(
() => View(viewPath),
() => View(viewPath));
@@ -99,7 +99,7 @@ namespace Umbraco.Web.BackOffice.Controllers
if (invite == null)
{
_logger.LogWarning<BackOfficeController>("VerifyUser endpoint reached with invalid token: NULL");
_logger.LogWarning("VerifyUser endpoint reached with invalid token: NULL");
return RedirectToAction(nameof(Default));
}
@@ -107,7 +107,7 @@ namespace Umbraco.Web.BackOffice.Controllers
if (parts.Length != 2)
{
_logger.LogWarning<BackOfficeController>("VerifyUser endpoint reached with invalid token: {Invite}", invite);
_logger.LogWarning("VerifyUser endpoint reached with invalid token: {Invite}", invite);
return RedirectToAction(nameof(Default));
}
@@ -116,7 +116,7 @@ namespace Umbraco.Web.BackOffice.Controllers
var decoded = token.FromUrlBase64();
if (decoded.IsNullOrWhiteSpace())
{
_logger.LogWarning<BackOfficeController>("VerifyUser endpoint reached with invalid token: {Invite}", invite);
_logger.LogWarning("VerifyUser endpoint reached with invalid token: {Invite}", invite);
return RedirectToAction(nameof(Default));
}
@@ -125,7 +125,7 @@ namespace Umbraco.Web.BackOffice.Controllers
var identityUser = await _userManager.FindByIdAsync(id);
if (identityUser == null)
{
_logger.LogWarning<BackOfficeController>("VerifyUser endpoint reached with non existing user: {UserId}", id);
_logger.LogWarning("VerifyUser endpoint reached with non existing user: {UserId}", id);
return RedirectToAction(nameof(Default));
}
@@ -133,7 +133,7 @@ namespace Umbraco.Web.BackOffice.Controllers
if (result.Succeeded == false)
{
_logger.LogWarning<BackOfficeController>("Could not verify email, Error: {Errors}, Token: {Invite}", result.Errors.ToErrorMessage(), invite);
_logger.LogWarning("Could not verify email, Error: {Errors}, Token: {Invite}", result.Errors.ToErrorMessage(), invite);
return new RedirectResult(Url.Action(nameof(Default)) + "#/login/false?invite=3");
}

View File

@@ -1619,7 +1619,7 @@ namespace Umbraco.Web.Editors
var sortResult = contentService.Sort(sorted.IdSortOrder, _webSecurity.CurrentUser.Id);
if (!sortResult.Success)
{
Logger.LogWarning<ContentController>("Content sorting failed, this was probably caused by an event being cancelled");
Logger.LogWarning("Content sorting failed, this was probably caused by an event being cancelled");
// TODO: Now you can cancel sorting, does the event messages bubble up automatically?
throw HttpResponseException.CreateValidationErrorResponse("Content sorting failed, this was probably caused by an event being cancelled");
}
@@ -2001,7 +2001,7 @@ namespace Umbraco.Web.Editors
if (template == null)
{
//ModelState.AddModelError("Template", "No template exists with the specified alias: " + contentItem.TemplateAlias);
Logger.LogWarning<ContentController>("No template exists with the specified alias: {TemplateAlias}", contentSave.TemplateAlias);
Logger.LogWarning("No template exists with the specified alias: {TemplateAlias}", contentSave.TemplateAlias);
}
else if (template.Id != contentSave.PersistedContent.TemplateId)
{

View File

@@ -78,7 +78,7 @@ namespace Umbraco.Web.BackOffice.Controllers
// get the property editor
if (propertyDto.PropertyEditor == null)
{
Logger.LogWarning<ContentControllerBase>("No property editor found for property {PropertyAlias}", propertyDto.Alias);
Logger.LogWarning("No property editor found for property {PropertyAlias}", propertyDto.Alias);
continue;
}

View File

@@ -461,7 +461,7 @@ namespace Umbraco.Web.BackOffice.Controllers
var tryCreateTemplate = _fileService.CreateTemplateForContentType(contentTypeAlias, contentTypeName);
if (tryCreateTemplate == false)
{
_logger.LogWarning<ContentTypeController>("Could not create a template for Content Type: \"{ContentTypeAlias}\", status: {Status}",
_logger.LogWarning("Could not create a template for Content Type: \"{ContentTypeAlias}\", status: {Status}",
contentTypeAlias, tryCreateTemplate.Result.Result);
}

View File

@@ -622,7 +622,7 @@ namespace Umbraco.Web.BackOffice.Controllers
// Save Media with new sort order and update content xml in db accordingly
if (mediaService.Sort(sortedMedia) == false)
{
Logger.LogWarning<MediaController>("Media sorting failed, this was probably caused by an event being cancelled");
Logger.LogWarning("Media sorting failed, this was probably caused by an event being cancelled");
throw HttpResponseException.CreateValidationErrorResponse("Media sorting failed, this was probably caused by an event being cancelled");
}
return Ok();