AB4227 - Review fixes - Added null logger + clean up
This commit is contained in:
@@ -5,6 +5,6 @@ namespace Umbraco.Composing
|
||||
public static class Current
|
||||
{
|
||||
|
||||
public static ILogger Logger { get; set; }
|
||||
public static ILogger Logger { get; set; } = new NullLogger();
|
||||
}
|
||||
}
|
||||
|
||||
109
src/Umbraco.Abstractions/Logging/NullLogger.cs
Normal file
109
src/Umbraco.Abstractions/Logging/NullLogger.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Logging
|
||||
{
|
||||
public class NullLogger : ILogger
|
||||
{
|
||||
public bool IsEnabled(Type reporting, LogLevel level) => false;
|
||||
|
||||
public void Fatal(Type reporting, Exception exception, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Fatal(Type reporting, Exception exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Fatal(Type reporting, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Fatal(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Fatal(Type reporting, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Error(Type reporting, Exception exception, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Error(Type reporting, Exception exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Error(Type reporting, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Error(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Error(Type reporting, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Warn(Type reporting, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Warn(Type reporting, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Warn(Type reporting, Exception exception, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Warn(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Info(Type reporting, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Info(Type reporting, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Debug(Type reporting, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Debug(Type reporting, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Verbose(Type reporting, string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Verbose(Type reporting, string messageTemplate, params object[] propertyValues)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="obj\**" />
|
||||
<Compile Remove="Scoping\ScopeReference.cs" />
|
||||
<Compile Remove="Scoping\ScopeProvider.cs" />
|
||||
<Compile Remove="Scoping\ScopeContext.cs" />
|
||||
<Compile Remove="Persistence\FaultHandling\SqlAzureTransientErrorDetectionStrategy.cs" />
|
||||
<Compile Remove="Persistence\FaultHandling\NetworkConnectivityErrorDetectionStrategy.cs" />
|
||||
<Compile Remove="Persistence\FaultHandling\Incremental.cs" />
|
||||
<Compile Remove="Persistence\FaultHandling\FixedInterval.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -64,9 +57,4 @@
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Events" />
|
||||
<Folder Include="Models\Identity" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,9 +4,7 @@ using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
|
||||
@@ -18,7 +16,6 @@ namespace Umbraco.Tests.Models
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Umbraco.Composing.Current.Logger = Current.Logger;
|
||||
Current.Reset();
|
||||
Current.UnlockConfigs(TestHelper.GetConfigsFactory(), TestHelper.IOHelper);
|
||||
Current.Configs.Add(SettingsForTests.GetDefaultGlobalSettings);
|
||||
|
||||
@@ -84,11 +84,11 @@ namespace Umbraco.Tests.TestHelpers
|
||||
}
|
||||
}
|
||||
|
||||
public static IShortStringHelper ShortStringHelper => new DefaultShortStringHelper(new DefaultShortStringHelperConfig());
|
||||
public static IDbProviderFactoryCreator DbProviderFactoryCreator => new UmbracoDbProviderFactoryCreator(Constants.DbProviderNames.SqlCe);
|
||||
public static IBulkSqlInsertProvider BulkSqlInsertProvider => new SqlCeBulkSqlInsertProvider();
|
||||
public static IShortStringHelper ShortStringHelper { get; } = new DefaultShortStringHelper(new DefaultShortStringHelperConfig());
|
||||
public static IDbProviderFactoryCreator DbProviderFactoryCreator { get; } = new UmbracoDbProviderFactoryCreator(Constants.DbProviderNames.SqlCe);
|
||||
public static IBulkSqlInsertProvider BulkSqlInsertProvider { get; } = new SqlCeBulkSqlInsertProvider();
|
||||
|
||||
public static IIOHelper IOHelper = new IOHelper(GetHostingEnvironment());
|
||||
public static IIOHelper IOHelper { get; } = new IOHelper(GetHostingEnvironment());
|
||||
|
||||
/// <summary>
|
||||
/// Maps the given <paramref name="relativePath"/> making it rooted on <see cref="CurrentAssemblyDirectory"/>. <paramref name="relativePath"/> must start with <code>~/</code>
|
||||
|
||||
@@ -40,12 +40,9 @@ namespace Umbraco.Web.Editors
|
||||
[IsCurrentUserModelFilter]
|
||||
public class UsersController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
|
||||
public UsersController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
|
||||
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -346,7 +343,7 @@ namespace Umbraco.Web.Editors
|
||||
throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
|
||||
}
|
||||
|
||||
if (EmailSender.CanSendRequiredEmail(_globalSettings) == false)
|
||||
if (EmailSender.CanSendRequiredEmail(GlobalSettings) == false)
|
||||
{
|
||||
throw new HttpResponseException(
|
||||
Request.CreateNotificationValidationErrorResponse("No Email server is configured"));
|
||||
@@ -476,7 +473,7 @@ namespace Umbraco.Web.Editors
|
||||
await UserManager.EmailService.SendAsync(
|
||||
//send the special UmbracoEmailMessage which configures it's own sender
|
||||
//to allow for events to handle sending the message if no smtp is configured
|
||||
new UmbracoEmailMessage(new EmailSender(_globalSettings, true))
|
||||
new UmbracoEmailMessage(new EmailSender(GlobalSettings, true))
|
||||
{
|
||||
Body = emailBody,
|
||||
Destination = userDisplay.Email,
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
_umbracoContextAccessor = umbracoContextAccessor;
|
||||
_dataTypeService = dataTypeService;
|
||||
_localizationService = localizationService;
|
||||
_ioHelper = Current.IOHelper;
|
||||
_ioHelper = ioHelper;
|
||||
_logger = logger;
|
||||
_mediaService = mediaService;
|
||||
_contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
|
||||
|
||||
Reference in New Issue
Block a user