Go back to LoggerFactory temporarily

- needed to unblock Hosting PR:
https://github.com/aspnet/Hosting/pull/146
- Service fallback currently is broken with generic services (ILogger<>
no worky)

Hosting issue tracking: https://github.com/aspnet/Hosting/issues/180
This commit is contained in:
Hao Kung 2015-03-05 12:28:30 -08:00
parent eeabe27606
commit ccb9f70545
2 changed files with 14 additions and 4 deletions

View File

@ -140,7 +140,10 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
// Properties are protected to ensure subclasses are correctly activated. Internal for ease of use when testing.
[Activate]
protected internal ILogger<LinkTagHelper> Logger { get; set; }
protected internal ILoggerFactory LoggerFactory { get; set; }
// TODO: will remove LoggerFactory and activate logger once DI/hosting bug is fixed
internal ILogger<LinkTagHelper> Logger { get; set; }
[Activate]
protected internal IHostingEnvironment HostingEnvironment { get; set; }
@ -162,7 +165,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{
var modeResult = AttributeMatcher.DetermineMode(context, ModeDetails);
modeResult.LogDetails(Logger, this, context.UniqueId, ViewContext.View.Path);
var logger = Logger ?? LoggerFactory.CreateLogger<ScriptTagHelper>();
modeResult.LogDetails(logger, this, context.UniqueId, ViewContext.View.Path);
if (!modeResult.FullMatches.Any())
{

View File

@ -118,7 +118,10 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
// Protected to ensure subclasses are correctly activated. Internal for ease of use when testing.
[Activate]
protected internal ILogger<ScriptTagHelper> Logger { get; set; }
protected internal ILoggerFactory LoggerFactory { get; set; }
// TODO: will remove LoggerFactory and activate logger once DI/hosting bug is fixed
internal ILogger<ScriptTagHelper> Logger { get; set; }
[Activate]
protected internal IHostingEnvironment HostingEnvironment { get; set; }
@ -140,7 +143,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
{
var modeResult = AttributeMatcher.DetermineMode(context, ModeDetails);
modeResult.LogDetails(Logger, this, context.UniqueId, ViewContext.View.Path);
var logger = Logger ?? LoggerFactory.CreateLogger<ScriptTagHelper>();
modeResult.LogDetails(logger, this, context.UniqueId, ViewContext.View.Path);
if (!modeResult.FullMatches.Any())
{