Merge pull request #2745 from aburok/hackathon-use-logger-info-with-func
Hackathon use logger info with func
This commit is contained in:
@@ -111,7 +111,7 @@ namespace Umbraco.Core.Components
|
||||
catch (Exception e)
|
||||
{
|
||||
// in case of an error, force-dump everything to log
|
||||
_logger.Info<BootLoader>(GetComponentsReport(requirements));
|
||||
_logger.Info<BootLoader>(() => GetComponentsReport(requirements));
|
||||
_logger.Error<BootLoader>("Failed to sort components.", e);
|
||||
throw;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Umbraco.Core.Configuration
|
||||
versionAttribute.SetValue(newVersion);
|
||||
clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting);
|
||||
|
||||
_logger.Info<ClientDependencyConfiguration>(string.Format("Updated version number from {0} to {1}", oldVersion, newVersion));
|
||||
_logger.Info<ClientDependencyConfiguration>(() => $"Updated version number from {oldVersion} to {newVersion}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ namespace Umbraco.Core.Configuration
|
||||
versionAttribute.SetValue(newVersion);
|
||||
clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting);
|
||||
|
||||
_logger.Info<ClientDependencyConfiguration>(string.Format("Updated version number from {0} to {1}", oldVersion, newVersion));
|
||||
_logger.Info<ClientDependencyConfiguration>(() => $"Updated version number from {oldVersion} to {newVersion}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Umbraco.Core.IO
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
Current.Logger.Info<PhysicalFileSystem>(string.Format("DeleteFile failed with FileNotFoundException: {0}", ex.InnerException));
|
||||
Current.Logger.Info<PhysicalFileSystem>(() => $"DeleteFile failed with FileNotFoundException: {ex.InnerException}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Umbraco.Core.Logging
|
||||
public IDisposable Step(string name)
|
||||
{
|
||||
_logger.Debug<LogProfiler>(() => $"Begin: {name}.");
|
||||
return new LightDisposableTimer(duration => _logger.Info<LogProfiler>($"End {name}. ({duration}ms)"));
|
||||
return new LightDisposableTimer(duration => _logger.Info<LogProfiler>(() => $"End {name}. ({duration}ms)"));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
{
|
||||
var source = connectionStrings.Attribute("configSource").Value;
|
||||
var configFile = IOHelper.MapPath($"{SystemDirectories.Root}/{source}");
|
||||
logger.Info<DatabaseBuilder>($"Storing ConnectionString in {configFile}");
|
||||
logger.Info<DatabaseBuilder>(() => $"Storing ConnectionString in {configFile}");
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
|
||||
@@ -335,7 +335,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
}
|
||||
|
||||
xml.Save(fileName, SaveOptions.DisableFormatting);
|
||||
logger.Info<DatabaseBuilder>("Configured a new ConnectionString using the '" + providerName + "' provider.");
|
||||
logger.Info<DatabaseBuilder>(() => $"Configured a new ConnectionString using the '{providerName}' provider.");
|
||||
}
|
||||
|
||||
internal bool IsConnectionStringConfigured(ConnectionStringSettings databaseSettings)
|
||||
@@ -500,7 +500,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
message = message + "<p>Installation completed!</p>";
|
||||
|
||||
//now that everything is done, we need to determine the version of SQL server that is executing
|
||||
_logger.Info<DatabaseBuilder>("Database configuration status: " + message);
|
||||
_logger.Info<DatabaseBuilder>(() => $"Database configuration status: {message}");
|
||||
return new Result { Message = message, Success = true, Percentage = "100" };
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
|
||||
//now that everything is done, we need to determine the version of SQL server that is executing
|
||||
|
||||
_logger.Info<DatabaseBuilder>("Database configuration status: " + message);
|
||||
_logger.Info<DatabaseBuilder>(() => $"Database configuration status: {message}");
|
||||
|
||||
return new Result { Message = message, Success = true, Percentage = "100" };
|
||||
}
|
||||
@@ -662,7 +662,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
|
||||
if (_databaseSchemaValidationResult != null)
|
||||
{
|
||||
_logger.Info<DatabaseBuilder>("The database schema validation produced the following summary: \n" + _databaseSchemaValidationResult.GetSummary());
|
||||
_logger.Info<DatabaseBuilder>(() => $"The database schema validation produced the following summary: {Environment.NewLine}{_databaseSchemaValidationResult.GetSummary()}");
|
||||
}
|
||||
|
||||
return new Result
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
/// <param name="tableName">Name of the table to create base data for</param>
|
||||
public void InitializeBaseData(string tableName)
|
||||
{
|
||||
_logger.Info<DatabaseDataCreator>($"Creating data in table {tableName}");
|
||||
_logger.Info<DatabaseDataCreator>(() => $"Creating data in table {tableName}");
|
||||
|
||||
if (tableName.Equals(Constants.DatabaseSchema.Tables.Node))
|
||||
CreateNodeData();
|
||||
@@ -76,7 +76,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
if (tableName.Equals(Constants.DatabaseSchema.Tables.KeyValue))
|
||||
CreateKeyValueData();
|
||||
|
||||
_logger.Info<DatabaseDataCreator>($"Done creating table {tableName} data.");
|
||||
_logger.Info<DatabaseDataCreator>(() => $"Done creating table {tableName} data.");
|
||||
}
|
||||
|
||||
private void CreateNodeData()
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Umbraco.Core.Migrations.Install
|
||||
var tableNameAttribute = table.FirstAttribute<TableNameAttribute>();
|
||||
var tableName = tableNameAttribute == null ? table.Name : tableNameAttribute.Value;
|
||||
|
||||
_logger.Info<DatabaseSchemaCreator>("Uninstall" + tableName);
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Uninstall {tableName}");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -388,13 +388,13 @@ namespace Umbraco.Core.Migrations.Install
|
||||
{
|
||||
//Execute the Create Table sql
|
||||
var created = _database.Execute(new Sql(createSql));
|
||||
_logger.Info<DatabaseSchemaCreator>($"Create Table '{tableName}' ({created}):\n {createSql}");
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Table '{tableName}' ({created}):\n {createSql}");
|
||||
|
||||
//If any statements exists for the primary key execute them here
|
||||
if (string.IsNullOrEmpty(createPrimaryKeySql) == false)
|
||||
{
|
||||
var createdPk = _database.Execute(new Sql(createPrimaryKeySql));
|
||||
_logger.Info<DatabaseSchemaCreator>($"Create Primary Key ({createdPk}):\n {createPrimaryKeySql}");
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Primary Key ({createdPk}):\n {createPrimaryKeySql}");
|
||||
}
|
||||
|
||||
//Turn on identity insert if db provider is not mysql
|
||||
@@ -420,21 +420,21 @@ namespace Umbraco.Core.Migrations.Install
|
||||
foreach (var sql in indexSql)
|
||||
{
|
||||
var createdIndex = _database.Execute(new Sql(sql));
|
||||
_logger.Info<DatabaseSchemaCreator>($"Create Index ({createdIndex}):\n {sql}");
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Index ({createdIndex}):\n {sql}");
|
||||
}
|
||||
|
||||
//Loop through foreignkey statements and execute sql
|
||||
foreach (var sql in foreignSql)
|
||||
{
|
||||
var createdFk = _database.Execute(new Sql(sql));
|
||||
_logger.Info<DatabaseSchemaCreator>($"Create Foreign Key ({createdFk}):\n {sql}");
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Create Foreign Key ({createdFk}):\n {sql}");
|
||||
}
|
||||
|
||||
transaction.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
_logger.Info<DatabaseSchemaCreator>($"Created table '{tableName}'");
|
||||
_logger.Info<DatabaseSchemaCreator>(() => $"Created table '{tableName}'");
|
||||
}
|
||||
|
||||
public void DropTable(string tableName)
|
||||
|
||||
@@ -211,11 +211,14 @@ namespace Umbraco.Core.Migrations
|
||||
if (_migrationBuilder == null || _logger == null)
|
||||
throw new InvalidOperationException("Cannot execute a non-executing plan.");
|
||||
|
||||
_logger.Info<MigrationPlan>($"Starting \"{Name}\"...");
|
||||
_logger.Info<MigrationPlan>(() => $"Starting \"{Name}\"...");
|
||||
var origState = fromState ?? string.Empty;
|
||||
var info = "At " + (string.IsNullOrWhiteSpace(origState) ? "origin" : ("\"" + origState + "\"")) + ".";
|
||||
info = info.Replace("{", "{{").Replace("}", "}}"); // stupid log4net
|
||||
_logger.Info<MigrationPlan>(info);
|
||||
|
||||
_logger.Info<MigrationPlan>(() =>
|
||||
{
|
||||
var info = "At " + (string.IsNullOrWhiteSpace(origState) ? "origin" : ("\"" + origState + "\"")) + ".";
|
||||
return info.Replace("{", "{{").Replace("}", "}}"); // stupid log4net
|
||||
});
|
||||
|
||||
if (!_transitions.TryGetValue(origState, out var transition))
|
||||
throw new Exception($"Unknown state \"{origState}\".");
|
||||
@@ -230,7 +233,7 @@ namespace Umbraco.Core.Migrations
|
||||
var nextState = transition.TargetState;
|
||||
origState = nextState;
|
||||
|
||||
_logger.Info<MigrationPlan>($"At \"{origState}\".");
|
||||
_logger.Info<MigrationPlan>(() => $"At \"{origState}\".");
|
||||
|
||||
if (!_transitions.TryGetValue(origState, out transition))
|
||||
throw new Exception($"Unknown state \"{origState}\".");
|
||||
|
||||
@@ -2094,7 +2094,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// raise Publishing event
|
||||
if (scope.Events.DispatchCancelable(Publishing, this, new PublishEventArgs<IContent>(content, evtMsgs)))
|
||||
{
|
||||
Logger.Info<ContentService>($"Document \"'{content.Name}\" (id={content.Id}) cannot be published: publishing was cancelled.");
|
||||
Logger.Info<ContentService>(() => $"Document \"'{content.Name}\" (id={content.Id}) cannot be published: publishing was cancelled.");
|
||||
return new PublishResult(PublishResultType.FailedCancelledByEvent, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2102,7 +2102,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// either because it is 'publishing' or because it already has a published version
|
||||
if (((Content) content).PublishedState != PublishedState.Publishing && content.PublishedVersionId == 0)
|
||||
{
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) cannot be published: document does not have published values.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document does not have published values.");
|
||||
return new PublishResult(PublishResultType.FailedNoPublishedValues, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2110,15 +2110,15 @@ namespace Umbraco.Core.Services.Implement
|
||||
switch (content.Status)
|
||||
{
|
||||
case ContentStatus.Expired:
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) cannot be published: document has expired.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document has expired.");
|
||||
return new PublishResult(PublishResultType.FailedHasExpired, evtMsgs, content);
|
||||
|
||||
case ContentStatus.AwaitingRelease:
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) cannot be published: document is awaiting release.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document is awaiting release.");
|
||||
return new PublishResult(PublishResultType.FailedAwaitingRelease, evtMsgs, content);
|
||||
|
||||
case ContentStatus.Trashed:
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) cannot be published: document is trashed.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: document is trashed.");
|
||||
return new PublishResult(PublishResultType.FailedIsTrashed, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2130,7 +2130,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
var pathIsOk = content.ParentId == Constants.System.Root || IsPathPublished(GetParent(content));
|
||||
if (pathIsOk == false)
|
||||
{
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) cannot be published: parent is not published.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be published: parent is not published.");
|
||||
return new PublishResult(PublishResultType.FailedPathNotPublished, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2154,7 +2154,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// change state to publishing
|
||||
((Content) content).PublishedState = PublishedState.Publishing;
|
||||
|
||||
Logger.Info<ContentService>($"Content \"{content.Name}\" (id={content.Id}) has been published.");
|
||||
Logger.Info<ContentService>(() => $"Content \"{content.Name}\" (id={content.Id}) has been published.");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2164,7 +2164,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
// raise UnPublishing event
|
||||
if (scope.Events.DispatchCancelable(UnPublishing, this, new PublishEventArgs<IContent>(content, evtMsgs)))
|
||||
{
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) cannot be unpublished: unpublishing was cancelled.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) cannot be unpublished: unpublishing was cancelled.");
|
||||
return new UnpublishResult(UnpublishResultType.FailedCancelledByEvent, evtMsgs, content);
|
||||
}
|
||||
|
||||
@@ -2187,13 +2187,13 @@ namespace Umbraco.Core.Services.Implement
|
||||
if (content.ReleaseDate.HasValue && content.ReleaseDate.Value <= DateTime.Now)
|
||||
{
|
||||
content.ReleaseDate = null;
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) had its release date removed, because it was unpublished.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) had its release date removed, because it was unpublished.");
|
||||
}
|
||||
|
||||
// change state to unpublishing
|
||||
((Content) content).PublishedState = PublishedState.Unpublishing;
|
||||
|
||||
Logger.Info<ContentService>($"Document \"{content.Name}\" (id={content.Id}) has been unpublished.");
|
||||
Logger.Info<ContentService>(() => $"Document \"{content.Name}\" (id={content.Id}) has been unpublished.");
|
||||
return attempt;
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace Umbraco.Web.Editors
|
||||
var lockedOut = await UserManager.IsLockedOutAsync(model.UserId);
|
||||
if (lockedOut)
|
||||
{
|
||||
Logger.Info<AuthenticationController>(
|
||||
Logger.Info<AuthenticationController>(() =>
|
||||
$"User {model.UserId} is currently locked out, unlocking and resetting AccessFailedCount");
|
||||
|
||||
//var user = await UserManager.FindByIdAsync(model.UserId);
|
||||
@@ -445,7 +445,7 @@ namespace Umbraco.Web.Editors
|
||||
Core.Constants.Security.BackOfficeAuthenticationType,
|
||||
Core.Constants.Security.BackOfficeExternalAuthenticationType);
|
||||
|
||||
Logger.Info<AuthenticationController>($"User {(User.Identity == null ? "UNKNOWN" : User.Identity.Name)} from IP address {owinContext.Request.RemoteIpAddress} has logged out");
|
||||
Logger.Info<AuthenticationController>(() => $"User {(User.Identity == null ? "UNKNOWN" : User.Identity.Name)} from IP address {owinContext.Request.RemoteIpAddress} has logged out");
|
||||
|
||||
if (UserManager != null)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ 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
|
||||
{
|
||||
@@ -71,7 +71,7 @@ namespace Umbraco.Web.HealthCheck
|
||||
|
||||
foreach (var checkResult in checkResults)
|
||||
{
|
||||
Logger.Info<HealthCheckResults>($" Result: {checkResult.ResultType}, Message: '{checkResult.Message}'");
|
||||
Logger.Info<HealthCheckResults>(() => $" Result: {checkResult.ResultType}, Message: '{checkResult.Message}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Web.Macros
|
||||
// note: we are not setting the 'CurrentNode' property on the control anymore,
|
||||
// as that was an INode which is gone in v8. Use UmbracoContext to access the
|
||||
// current content.
|
||||
Current.Logger.Info<UserControlMacroEngine>($"Loaded control \"{filename}\" with ID \"{control.ID}\".");
|
||||
Current.Logger.Info<UserControlMacroEngine>(() => $"Loaded control \"{filename}\" with ID \"{control.ID}\".");
|
||||
UpdateControlProperties(control, model);
|
||||
|
||||
return new MacroContent { Control = control };
|
||||
|
||||
@@ -667,7 +667,7 @@ namespace Umbraco.Web.Scheduling
|
||||
if (_terminating == false)
|
||||
{
|
||||
_terminating = true;
|
||||
_logger.Info<BackgroundTaskRunner>(_logPrefix + "Terminating" + (immediate ? " (immediate)" : ""));
|
||||
_logger.Info<BackgroundTaskRunner>(() => $"{_logPrefix}Terminating{(immediate ? immediate.ToString() : "")}");
|
||||
onTerminating = true;
|
||||
}
|
||||
}
|
||||
@@ -681,7 +681,7 @@ namespace Umbraco.Web.Scheduling
|
||||
// processing, call the UnregisterObject method, and then return or it can return immediately and complete
|
||||
// processing asynchronously before calling the UnregisterObject method.
|
||||
|
||||
_logger.Info<BackgroundTaskRunner>(_logPrefix + "Waiting for tasks to complete");
|
||||
_logger.Info<BackgroundTaskRunner>(() => _logPrefix + "Waiting for tasks to complete");
|
||||
Shutdown(false, false); // do not accept any more tasks, flush the queue, do not wait
|
||||
|
||||
// raise the completed event only after the running threading task has completed
|
||||
@@ -700,7 +700,7 @@ namespace Umbraco.Web.Scheduling
|
||||
// immediate parameter is true, the registered object must call the UnregisterObject method before returning;
|
||||
// otherwise, its registration will be removed by the application manager.
|
||||
|
||||
_logger.Info<BackgroundTaskRunner>(_logPrefix + "Cancelling tasks");
|
||||
_logger.Info<BackgroundTaskRunner>(() => _logPrefix + "Cancelling tasks");
|
||||
Shutdown(true, true); // cancel all tasks, wait for the current one to end
|
||||
Terminate(true);
|
||||
}
|
||||
@@ -723,7 +723,7 @@ namespace Umbraco.Web.Scheduling
|
||||
terminatedSource = _terminatedSource;
|
||||
}
|
||||
|
||||
_logger.Info<BackgroundTaskRunner>(_logPrefix + "Tasks " + (immediate ? "cancelled" : "completed") + ", terminated");
|
||||
_logger.Info<BackgroundTaskRunner>(() => _logPrefix + "Tasks " + (immediate ? "cancelled" : "completed") + ", terminated");
|
||||
|
||||
OnEvent(Terminated, "Terminated");
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Umbraco.Web.Search
|
||||
|
||||
var registeredIndexers = examineManager.IndexProviders.Values.OfType<UmbracoExamineIndexer>().Count(x => x.EnableDefaultEventHandler);
|
||||
|
||||
profilingLogger.Logger.Info<ExamineComponent>($"Adding examine event handlers for {registeredIndexers} index providers.");
|
||||
profilingLogger.Logger.Info<ExamineComponent>(() => $"Adding examine event handlers for {registeredIndexers} index providers.");
|
||||
|
||||
// don't bind event handlers if we're not suppose to listen
|
||||
if (registeredIndexers == 0)
|
||||
@@ -200,7 +200,7 @@ namespace Umbraco.Web.Search
|
||||
var dir = luceneIndexer.GetLuceneDirectory();
|
||||
if (IndexWriter.IsLocked(dir))
|
||||
{
|
||||
logger.Info<ExamineComponent>("Forcing index " + luceneIndexer.Name + " to be unlocked since it was left in a locked state");
|
||||
logger.Info<ExamineComponent>(() => $"Forcing index {luceneIndexer.Name} to be unlocked since it was left in a locked state");
|
||||
IndexWriter.Unlock(dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,11 +525,8 @@ namespace Umbraco.Web.Security.Providers
|
||||
|
||||
if (member == null)
|
||||
{
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user does not exist",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(() =>
|
||||
$"Login attempt failed for username {username} from IP address {GetCurrentRequestIpAddress()}, the user does not exist" );
|
||||
|
||||
return new ValidateUserResult
|
||||
{
|
||||
@@ -539,11 +536,8 @@ namespace Umbraco.Web.Security.Providers
|
||||
|
||||
if (member.IsApproved == false)
|
||||
{
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user is not approved",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(() =>
|
||||
$"Login attempt failed for username {username} from IP address {GetCurrentRequestIpAddress()}, the user is not approved");
|
||||
|
||||
return new ValidateUserResult
|
||||
{
|
||||
@@ -553,11 +547,8 @@ namespace Umbraco.Web.Security.Providers
|
||||
}
|
||||
if (member.IsLockedOut)
|
||||
{
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user is locked",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(() =>
|
||||
$"Login attempt failed for username {username} from IP address {GetCurrentRequestIpAddress()}, the user is locked");
|
||||
|
||||
return new ValidateUserResult
|
||||
{
|
||||
@@ -581,19 +572,13 @@ namespace Umbraco.Web.Security.Providers
|
||||
member.IsLockedOut = true;
|
||||
member.LastLockoutDate = DateTime.Now;
|
||||
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user is now locked out, max invalid password attempts exceeded",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(() =>
|
||||
$"Login attempt failed for username {username} from IP address {GetCurrentRequestIpAddress()}, the user is now locked out, max invalid password attempts exceeded");
|
||||
}
|
||||
else
|
||||
{
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(() =>
|
||||
$"Login attempt failed for username {username} from IP address {GetCurrentRequestIpAddress()}");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -606,11 +591,8 @@ namespace Umbraco.Web.Security.Providers
|
||||
|
||||
member.LastLoginDate = DateTime.Now;
|
||||
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt succeeded for username {0} from IP address {1}",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
Current.Logger.Info<UmbracoMembershipProviderBase>(() =>
|
||||
$"Login attempt succeeded for username {username} from IP address {GetCurrentRequestIpAddress()}");
|
||||
}
|
||||
|
||||
//don't raise events for this! It just sets the member dates, if we do raise events this will
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Umbraco.Web.WebServices
|
||||
var msg = ValidateLuceneIndexer(indexerName, out LuceneIndexer indexer);
|
||||
if (msg.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.Info<ExamineManagementApiController>($"Rebuilding index '{indexerName}'");
|
||||
_logger.Info<ExamineManagementApiController>(() => $"Rebuilding index '{indexerName}'");
|
||||
|
||||
//remove it in case there's a handler there alraedy
|
||||
indexer.IndexOperationComplete -= Indexer_IndexOperationComplete;
|
||||
@@ -203,7 +203,7 @@ namespace Umbraco.Web.WebServices
|
||||
//ensure it's not listening anymore
|
||||
indexer.IndexOperationComplete -= Indexer_IndexOperationComplete;
|
||||
|
||||
_logger.Info<ExamineManagementApiController>($"Rebuilding index '{indexer.Name}' done, {indexer.CommitCount} items committed (can differ from the number of items in the index)");
|
||||
_logger.Info<ExamineManagementApiController>(() => $"Rebuilding index '{indexer.Name}' done, {indexer.CommitCount} items committed (can differ from the number of items in the index)");
|
||||
|
||||
var cacheKey = "temp_indexing_op_" + indexer.Name;
|
||||
_runtimeCacheProvider.ClearCacheItem(cacheKey);
|
||||
|
||||
Reference in New Issue
Block a user