Remove public Logger from DataEditor

It was only used one place where it shouldn't be used
This commit is contained in:
Mole
2020-09-18 14:45:22 +02:00
parent 578e8c4f9e
commit a3d74bb79f
3 changed files with 6 additions and 10 deletions

View File

@@ -49,16 +49,16 @@ namespace Umbraco.Web.PropertyEditors
#region Value Editor
protected override IDataValueEditor CreateValueEditor() => new BlockEditorPropertyValueEditor(Attribute, PropertyEditors, _dataTypeService, _contentTypeService, _localizedTextService, Logger, LocalizationService,ShortStringHelper);
protected override IDataValueEditor CreateValueEditor() => new BlockEditorPropertyValueEditor(Attribute, PropertyEditors, _dataTypeService, _contentTypeService, _localizedTextService, LoggerFactory.CreateLogger<BlockEditorPropertyValueEditor>(), LocalizationService,ShortStringHelper);
internal class BlockEditorPropertyValueEditor : DataValueEditor, IDataValueReference
{
private readonly PropertyEditorCollection _propertyEditors;
private readonly IDataTypeService _dataTypeService;
private readonly ILogger _logger;
private readonly ILogger<BlockEditorPropertyValueEditor> _logger;
private readonly BlockEditorValues _blockEditorValues;
public BlockEditorPropertyValueEditor(DataEditorAttribute attribute, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IContentTypeService contentTypeService, ILocalizedTextService textService, ILogger logger, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
public BlockEditorPropertyValueEditor(DataEditorAttribute attribute, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IContentTypeService contentTypeService, ILocalizedTextService textService, ILogger<BlockEditorPropertyValueEditor> logger, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
: base(dataTypeService, localizationService, textService, shortStringHelper, attribute)
{
_propertyEditors = propertyEditors;

View File

@@ -34,7 +34,6 @@ namespace Umbraco.Core.PropertyEditors
LocalizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
LocalizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
ShortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
Logger = LoggerFactory.CreateLogger<DataEditor>();
// defaults
@@ -65,11 +64,6 @@ namespace Umbraco.Core.PropertyEditors
protected ILoggerFactory LoggerFactory { get; }
protected IDataTypeService DataTypeService { get; }
/// <summary>
/// Gets a logger.
/// </summary>
protected ILogger<DataEditor> Logger { get; }
/// <inheritdoc />
[DataMember(Name = "alias", IsRequired = true)]
public string Alias { get; internal set; }

View File

@@ -36,6 +36,7 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
private readonly UploadAutoFillProperties _autoFillProperties;
private readonly ILogger<ImageCropperPropertyEditor> _logger;
/// <summary>
/// Initializes a new instance of the <see cref="ImageCropperPropertyEditor"/> class.
@@ -56,6 +57,7 @@ namespace Umbraco.Web.PropertyEditors
_dataTypeService = dataTypeService;
_localizationService = localizationService;
_ioHelper = ioHelper;
_logger = loggerFactory.CreateLogger<ImageCropperPropertyEditor>();
// TODO: inject?
_autoFillProperties = new UploadAutoFillProperties(_mediaFileSystem, loggerFactory.CreateLogger<UploadAutoFillProperties>(), contentSettings);
@@ -113,7 +115,7 @@ namespace Umbraco.Web.PropertyEditors
catch (Exception ex)
{
if (writeLog)
Logger.LogError(ex, "Could not parse image cropper value '{Json}'", value);
_logger.LogError(ex, "Could not parse image cropper value '{Json}'", value);
return null;
}
}