Change calls to logger.Warn method to use Func<string> second part
This commit is contained in:
@@ -40,8 +40,7 @@ namespace Umbraco.Web
|
||||
|
||||
if (_databaseFactory.CanConnect == false)
|
||||
{
|
||||
Logger.Warn<BatchedDatabaseServerMessenger>(
|
||||
"Cannot connect to the database, distributed calls will not be enabled for this server.");
|
||||
Logger.Warn<BatchedDatabaseServerMessenger>("Cannot connect to the database, distributed calls will not be enabled for this server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Umbraco.Web.Editors
|
||||
if (resetResult.Succeeded == false)
|
||||
{
|
||||
var errors = string.Join(". ", resetResult.Errors);
|
||||
_logger.Warn<PasswordChanger>($"Could not reset user password {errors}");
|
||||
_logger.Warn<PasswordChanger>(() => $"Could not reset user password {errors}");
|
||||
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not reset password, errors: " + errors, new[] { "resetPassword" }) });
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Umbraco.Web.Editors
|
||||
if (changeResult.Succeeded == false)
|
||||
{
|
||||
var errors = string.Join(". ", changeResult.Errors);
|
||||
_logger.Warn<PasswordChanger>($"Could not change user password {errors}");
|
||||
_logger.Warn<PasswordChanger>(() => $"Could not change user password {errors}");
|
||||
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not change password, errors: " + errors, new[] { "oldPassword" }) });
|
||||
}
|
||||
return Attempt.Succeed(new PasswordChangedModel());
|
||||
|
||||
@@ -62,16 +62,16 @@ namespace Umbraco.Web.HealthCheck
|
||||
var checkIsSuccess = result.Value.All(x => x.ResultType == StatusResultType.Success);
|
||||
if (checkIsSuccess)
|
||||
{
|
||||
Logger.Info<HealthCheckResults>($" Checks for '{checkName}' all completed succesfully.");
|
||||
Logger.Info<HealthCheckResults>(() => $" Checks for '{checkName}' all completed succesfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Warn<HealthCheckResults>($" Checks for '{checkName}' completed with errors.");
|
||||
Logger.Warn<HealthCheckResults>(() => $" Checks for '{checkName}' completed with errors.");
|
||||
}
|
||||
|
||||
foreach (var checkResult in checkResults)
|
||||
{
|
||||
Logger.Info<HealthCheckResults>($" Result: {checkResult.ResultType}, Message: '{checkResult.Message}'");
|
||||
Logger.Info<HealthCheckResults>(() => $" Result: {checkResult.ResultType}, Message: '{checkResult.Message}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Umbraco.Web.Macros
|
||||
var controlProperty = type.GetProperty(modelProperty.Key);
|
||||
if (controlProperty == null)
|
||||
{
|
||||
Current.Logger.Warn<UserControlMacroEngine>($"Control property \"{modelProperty.Key}\" doesn't exist or isn't accessible, skip.");
|
||||
Current.Logger.Warn<UserControlMacroEngine>(() => $"Control property \"{modelProperty.Key}\" doesn't exist or isn't accessible, skip.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
if (configuration.TryGetValue(field.Key, out var value))
|
||||
field.Value = value;
|
||||
else // weird - just leave the field without a value - but warn
|
||||
Current.Logger.Warn<DataTypeConfigurationFieldDisplayResolver>($"Could not find a value for configuration field \"{field.Key}\".");
|
||||
Current.Logger.Warn<DataTypeConfigurationFieldDisplayResolver>(() => $"Could not find a value for configuration field \"{field.Key}\".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
//we'll just map this to a text box
|
||||
paramEditor = Current.ParameterEditors[Constants.PropertyEditors.Aliases.TextBox];
|
||||
Current.Logger.Warn<MacroMapperProfile>("Could not resolve a parameter editor with alias " + property.EditorAlias + ", a textbox will be rendered in it's place");
|
||||
Current.Logger.Warn<MacroMapperProfile>(() => $"Could not resolve a parameter editor with alias {property.EditorAlias}, a textbox will be rendered in it's place");
|
||||
}
|
||||
|
||||
parameter.View = paramEditor.GetValueEditor().View;
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Warn<RelatedLinksValueConverter>($"Related Links value converter skipped a link as the node has been unpublished/deleted (Internal Link NodeId: {relatedLink.Link}, Link Caption: \"{relatedLink.Caption}\")");
|
||||
_logger.Warn<RelatedLinksValueConverter>(() => $"Related Links value converter skipped a link as the node has been unpublished/deleted (Internal Link NodeId: {relatedLink.Link}, Link Caption: \"{relatedLink.Caption}\")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
throw new Exception("Missing cmsContentNu edited content for node " + dto.Id + ", consider rebuilding.");
|
||||
Current.Logger.Warn<DatabaseDataSource>("Missing cmsContentNu edited content for node " + dto.Id + ", consider rebuilding.");
|
||||
Current.Logger.Warn<DatabaseDataSource>(() => $"Missing cmsContentNu edited content for node {dto.Id}, consider rebuilding.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -211,7 +211,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
throw new Exception("Missing cmsContentNu published content for node " + dto.Id + ", consider rebuilding.");
|
||||
Current.Logger.Warn<DatabaseDataSource>("Missing cmsContentNu published content for node " + dto.Id + ", consider rebuilding.");
|
||||
Current.Logger.Warn<DatabaseDataSource>(() => $"Missing cmsContentNu published content for node {dto.Id}, consider rebuilding.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
else
|
||||
{
|
||||
// this is a property that does not correspond to anything, ignore and log
|
||||
Current.Logger.Warn<PublishedMediaCache>("Dropping property \"" + i.Key + "\" because it does not belong to the content type.");
|
||||
Current.Logger.Warn<PublishedMediaCache>(() => "Dropping property \"" + i.Key + "\" because it does not belong to the content type.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace Umbraco.Web.Security
|
||||
if (member == null)
|
||||
{
|
||||
//this should not happen
|
||||
Current.Logger.Warn<MembershipHelper>("The member validated but then no member was returned with the username " + username);
|
||||
Current.Logger.Warn<MembershipHelper>(() => $"The member validated but then no member was returned with the username {username}");
|
||||
return false;
|
||||
}
|
||||
//Log them in
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Umbraco.Web.Security.Providers
|
||||
if (MemberService.Exists(username))
|
||||
{
|
||||
status = MembershipCreateStatus.DuplicateUserName;
|
||||
Current.Logger.Warn<UmbracoMembershipProvider<T, TEntity>>("Cannot create member as username already exists: " + username);
|
||||
Current.Logger.Warn<UmbracoMembershipProvider<T, TEntity>>(() => $"Cannot create member as username already exists: {username}");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -157,8 +157,7 @@ namespace Umbraco.Web.Security.Providers
|
||||
if (MemberService.GetByEmail(email) != null && RequiresUniqueEmail)
|
||||
{
|
||||
status = MembershipCreateStatus.DuplicateEmail;
|
||||
Current.Logger.Warn<UmbracoMembershipProvider<T, TEntity>>(
|
||||
"Cannot create member as a member with the same email address exists: " + email);
|
||||
Current.Logger.Warn<UmbracoMembershipProvider<T, TEntity>>(() => $"Cannot create member as a member with the same email address exists: {email}");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace Umbraco.Web.Services
|
||||
var clrType = Type.GetType(type);
|
||||
if (clrType == null)
|
||||
{
|
||||
_logger.Warn<ApplicationTreeService>("The tree definition: " + addElement.ToString() + " could not be resolved to a .Net object type");
|
||||
_logger.Warn<ApplicationTreeService>(() => $"The tree definition: {addElement} could not be resolved to a .Net object type");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user