Improve logging performance by checking Trace/Debug log level is enabled (#12793)
This commit is contained in:
@@ -17,8 +17,11 @@ public class PreValueMigratorCollection : BuilderCollectionBase<IPreValueMigrato
|
||||
public IPreValueMigrator? GetMigrator(string editorAlias)
|
||||
{
|
||||
IPreValueMigrator? migrator = this.FirstOrDefault(x => x.CanMigrate(editorAlias));
|
||||
_logger.LogDebug("Getting migrator for \"{EditorAlias}\" = {MigratorType}", editorAlias,
|
||||
if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
|
||||
{
|
||||
_logger.LogDebug("Getting migrator for \"{EditorAlias}\" = {MigratorType}", editorAlias,
|
||||
migrator == null ? "<null>" : migrator.GetType().Name);
|
||||
}
|
||||
return migrator;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user