Logging API changes
This commit is contained in:
parent
c290e897b0
commit
f4ea1b82fa
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
IOptions<AuthorizationOptions> options)
|
||||
{
|
||||
_actionModelBuilder = actionModelBuilder;
|
||||
_logger = loggerFactory.Create<DefaultControllerModelBuilder>();
|
||||
_logger = loggerFactory.CreateLogger<DefaultControllerModelBuilder>();
|
||||
_authorizationOptions = options?.Options ?? new AuthorizationOptions();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
_applicationModelBuilder = applicationModelBuilder;
|
||||
_globalFilters = globalFilters.Filters;
|
||||
_conventions = optionsAccessor.Options.Conventions;
|
||||
_logger = loggerFactory.Create<ControllerActionDescriptorProvider>();
|
||||
_logger = loggerFactory.CreateLogger<ControllerActionDescriptorProvider>();
|
||||
}
|
||||
|
||||
public int Order
|
||||
|
|
@ -59,7 +59,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
{
|
||||
foreach (var controller in applicationModel.Controllers)
|
||||
{
|
||||
_logger.WriteVerbose(new ControllerModelValues(controller));
|
||||
_logger.LogVerbose(new ControllerModelValues(controller));
|
||||
}
|
||||
}
|
||||
return ControllerActionDescriptorBuilder.Build(applicationModel);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
public DefaultActionDescriptorsCollectionProvider(IServiceProvider serviceProvider, ILoggerFactory factory)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
_logger = factory.Create<DefaultActionDescriptorsCollectionProvider>();
|
||||
_logger = factory.CreateLogger<DefaultActionDescriptorsCollectionProvider>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
{
|
||||
foreach (var actionDescriptor in context.Results)
|
||||
{
|
||||
_logger.WriteVerbose(new ActionDescriptorValues(actionDescriptor));
|
||||
_logger.LogVerbose(new ActionDescriptorValues(actionDescriptor));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
_actionDescriptorsCollectionProvider = actionDescriptorsCollectionProvider;
|
||||
_decisionTreeProvider = decisionTreeProvider;
|
||||
_actionConstraintProviders = actionConstraintProviders.OrderBy(item => item.Order).ToArray();
|
||||
_logger = loggerFactory.Create<DefaultActionSelector>();
|
||||
_logger = loggerFactory.CreateLogger<DefaultActionSelector>();
|
||||
}
|
||||
|
||||
public Task<ActionDescriptor> SelectAsync([NotNull] RouteContext context)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
_assemblyProvider = assemblyProvider;
|
||||
_logger = loggerFactory.Create<DefaultControllerTypeProvider>();
|
||||
_logger = loggerFactory.CreateLogger<DefaultControllerTypeProvider>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
foreach (var assembly in candidateAssemblies)
|
||||
{
|
||||
_logger.WriteVerbose(new AssemblyValues(assembly));
|
||||
_logger.LogVerbose(new AssemblyValues(assembly));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// <summary>
|
||||
/// Logging representation of an <see cref="IActionConstraintMetadata"/>.
|
||||
/// </summary>
|
||||
public class ActionConstraintValues : LoggerStructureBase
|
||||
public class ActionConstraintValues : ReflectionBasedLogValues
|
||||
{
|
||||
public ActionConstraintValues(IActionConstraintMetadata inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Logging representation of the state of an <see cref="ActionDescriptor"/> or
|
||||
/// <see cref="ControllerActionDescriptor"/>. Logged during action discovery.
|
||||
/// </summary>
|
||||
public class ActionDescriptorValues : LoggerStructureBase
|
||||
public class ActionDescriptorValues : ReflectionBasedLogValues
|
||||
{
|
||||
public ActionDescriptorValues([NotNull] ActionDescriptor inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Represents the state of an <see cref="ActionModel"/>.
|
||||
/// Logged as a substructure of <see cref="ControllerModelValues"/>
|
||||
/// </summary>
|
||||
public class ActionModelValues : LoggerStructureBase
|
||||
public class ActionModelValues : ReflectionBasedLogValues
|
||||
{
|
||||
// note: omit the controller as this structure is nested inside the ControllerModelValues it belongs to
|
||||
public ActionModelValues(ActionModel inner)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// <summary>
|
||||
/// Logging representation of an <see cref="ApiExplorerModel"/>.
|
||||
/// </summary>
|
||||
public class ApiExplorerModelValues : LoggerStructureBase
|
||||
public class ApiExplorerModelValues : ReflectionBasedLogValues
|
||||
{
|
||||
public ApiExplorerModelValues(ApiExplorerModel inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// <summary>
|
||||
/// Logging representation of the state of an <see cref="Assembly"/>. Logged during Assembly discovery in Startup.
|
||||
/// </summary>
|
||||
public class AssemblyValues : LoggerStructureBase
|
||||
public class AssemblyValues : ReflectionBasedLogValues
|
||||
{
|
||||
public AssemblyValues([NotNull] Assembly inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Logging representation of the state of a <see cref="AttributeRouteInfo"/>. Logged as a substructure of
|
||||
/// <see cref="ActionDescriptorValues"/>.
|
||||
/// </summary>
|
||||
public class AttributeRouteInfoValues : LoggerStructureBase
|
||||
public class AttributeRouteInfoValues : ReflectionBasedLogValues
|
||||
{
|
||||
public AttributeRouteInfoValues(AttributeRouteInfo inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Logging representation of the state of a <see cref="AttributeRouteModel"/>. Logged as a substructure of
|
||||
/// <see cref="ControllerModelValues"/>.
|
||||
/// </summary>
|
||||
public class AttributeRouteModelValues : LoggerStructureBase
|
||||
public class AttributeRouteModelValues : ReflectionBasedLogValues
|
||||
{
|
||||
public AttributeRouteModelValues(AttributeRouteModel inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// <summary>
|
||||
/// Logging representation of the state of a <see cref="ControllerModel"/>. Logged during controller discovery.
|
||||
/// </summary>
|
||||
public class ControllerModelValues : LoggerStructureBase
|
||||
public class ControllerModelValues : ReflectionBasedLogValues
|
||||
{
|
||||
public ControllerModelValues(ControllerModel inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Logging representation of the state of a <see cref="FilterDescriptor"/>. Logged as a substructure of
|
||||
/// <see cref="ActionDescriptorValues"/>.
|
||||
/// </summary>
|
||||
public class FilterDescriptorValues : LoggerStructureBase
|
||||
public class FilterDescriptorValues : ReflectionBasedLogValues
|
||||
{
|
||||
public FilterDescriptorValues([NotNull] FilterDescriptor inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// <see cref="FilterDescriptorValues"/>, and as a substructure of <see cref="ControllerModelValues"/>
|
||||
/// and <see cref="ActionModelValues"/>.
|
||||
/// </summary>
|
||||
public class FilterValues : LoggerStructureBase
|
||||
public class FilterValues : ReflectionBasedLogValues
|
||||
{
|
||||
public FilterValues(IFilter inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
{
|
||||
public static void WriteValues([NotNull] this ILogger logger, object values)
|
||||
{
|
||||
logger.Write(
|
||||
logger.Log(
|
||||
logLevel: LogLevel.Verbose,
|
||||
eventId: 0,
|
||||
state: values,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Logging representation of a <see cref="ParameterDescriptor"/>. Logged as a substructure of
|
||||
/// <see cref="ActionDescriptorValues"/>.
|
||||
/// </summary>
|
||||
public class ParameterDescriptorValues : LoggerStructureBase
|
||||
public class ParameterDescriptorValues : ReflectionBasedLogValues
|
||||
{
|
||||
public ParameterDescriptorValues([NotNull] ParameterDescriptor inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// <see cref="ActionModelValues"/>, this contains the name, type, and
|
||||
/// binder metadata of the parameter.
|
||||
/// </summary>
|
||||
public class ParameterModelValues : LoggerStructureBase
|
||||
public class ParameterModelValues : ReflectionBasedLogValues
|
||||
{
|
||||
public ParameterModelValues([NotNull] ParameterModel inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Logging representation of a <see cref="IRouteConstraintProvider"/>. Logged as a substructure of
|
||||
/// <see cref="ControllerModelValues"/>
|
||||
/// </summary>
|
||||
public class RouteConstraintProviderValues : LoggerStructureBase
|
||||
public class RouteConstraintProviderValues : ReflectionBasedLogValues
|
||||
{
|
||||
public RouteConstraintProviderValues([NotNull] IRouteConstraintProvider inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Logging representation of the state of a <see cref="RouteDataActionConstraint"/>. Logged as a substructure of
|
||||
/// <see cref="ActionDescriptorValues"/>.
|
||||
/// </summary>
|
||||
public class RouteDataActionConstraintValues : LoggerStructureBase
|
||||
public class RouteDataActionConstraintValues : ReflectionBasedLogValues
|
||||
{
|
||||
public RouteDataActionConstraintValues([NotNull] RouteDataActionConstraint inner)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
if (_logger == null)
|
||||
{
|
||||
var factory = context.RequestServices.GetRequiredService<ILoggerFactory>();
|
||||
_logger = factory.Create<MvcRouteHandler>();
|
||||
_logger = factory.CreateLogger<MvcRouteHandler>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
_actionDescriptorsCollectionProvider = actionDescriptorsCollectionProvider;
|
||||
_constraintResolver = constraintResolver;
|
||||
|
||||
_routeLogger = loggerFactory.Create<InnerAttributeRoute>();
|
||||
_constraintLogger = loggerFactory.Create(typeof(RouteConstraintMatcher).FullName);
|
||||
_routeLogger = loggerFactory.CreateLogger<InnerAttributeRoute>();
|
||||
_constraintLogger = loggerFactory.CreateLogger(typeof(RouteConstraintMatcher).FullName);
|
||||
|
||||
// Force creation of the route to report issues on startup.
|
||||
GetInnerRoute();
|
||||
|
|
|
|||
|
|
@ -55,12 +55,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
|
|||
attribute => PartiallyMatchedAttributes.Contains(
|
||||
attribute, StringComparer.OrdinalIgnoreCase)));
|
||||
|
||||
logger.WriteWarning(new PartialModeMatchLoggerStructure<TMode>(uniqueId, viewPath, partialOnlyMatches));
|
||||
logger.LogWarning(new PartialModeMatchLoggerStructure<TMode>(uniqueId, viewPath, partialOnlyMatches));
|
||||
}
|
||||
|
||||
if (logger.IsEnabled(LogLevel.Verbose) && !FullMatches.Any())
|
||||
{
|
||||
logger.WriteVerbose("Skipping processing for {0} {1}",
|
||||
logger.LogVerbose("Skipping processing for {0} {1}",
|
||||
tagHelper.GetType().GetTypeInfo().FullName, uniqueId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using Microsoft.Framework.Logging;
|
|||
namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="ILoggerStructure"/> for log messages regarding <see cref="ITagHelper"/> instances that opt out of
|
||||
/// An <see cref="ILogValues"/> for log messages regarding <see cref="ITagHelper"/> instances that opt out of
|
||||
/// processing due to missing attributes for one of several possible modes.
|
||||
/// </summary>
|
||||
public class PartialModeMatchLoggerStructure<TMode> : PartialModeMatchLoggerStructure
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ using Microsoft.Framework.Logging;
|
|||
namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="ILoggerStructure"/> for log messages regarding <see cref="ITagHelper"/> instances that opt out of
|
||||
/// An <see cref="ILogValues"/> for log messages regarding <see cref="ITagHelper"/> instances that opt out of
|
||||
/// processing due to missing attributes for one of several possible modes.
|
||||
/// </summary>
|
||||
public abstract class PartialModeMatchLoggerStructure : ILoggerStructure
|
||||
public abstract class PartialModeMatchLoggerStructure : ILogValues
|
||||
{
|
||||
private readonly IEnumerable<KeyValuePair<string, object>> _values;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
return NullDisposable.Instance;
|
||||
}
|
||||
|
||||
public void Write(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
public void Log(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
public LogLevel MinimumLevel { get; set; }
|
||||
|
||||
public ILogger Create(string name)
|
||||
public ILogger CreateLogger(string name)
|
||||
{
|
||||
return NullLogger.Instance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
return NullDisposable.Instance;
|
||||
}
|
||||
|
||||
public void Write(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
public void Log(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
{
|
||||
_sink.Write(new WriteContext()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
public LogLevel MinimumLevel { get; set; }
|
||||
|
||||
public ILogger Create(string name)
|
||||
public ILogger CreateLogger(string name)
|
||||
{
|
||||
return new TestLogger(name, _sink);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1710,8 +1710,8 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
new StubRouter(),
|
||||
entries,
|
||||
Enumerable.Empty<AttributeRouteLinkGenerationEntry>(),
|
||||
loggerFactory.Create<AttributeRoute>(),
|
||||
loggerFactory.Create(typeof(RouteConstraintMatcher).FullName),
|
||||
loggerFactory.CreateLogger<AttributeRoute>(),
|
||||
loggerFactory.CreateLogger(typeof(RouteConstraintMatcher).FullName),
|
||||
version: 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
public class NullLoggerFactory : ILoggerFactory
|
||||
{
|
||||
public LogLevel MinimumLevel { get; set; }
|
||||
|
||||
public static NullLoggerFactory Instance = new NullLoggerFactory();
|
||||
|
||||
public ILogger Create(string name)
|
||||
{
|
||||
return NullLogger.Instance;
|
||||
}
|
||||
|
||||
public void AddProvider(ILoggerProvider provider)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class NullLogger : ILogger
|
||||
{
|
||||
public static NullLogger Instance = new NullLogger();
|
||||
|
||||
public IDisposable BeginScope(object state)
|
||||
{
|
||||
return NullDisposable.Instance;
|
||||
}
|
||||
|
||||
public void Write(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsEnabled(LogLevel logLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class NullDisposable : IDisposable
|
||||
{
|
||||
public static NullDisposable Instance = new NullDisposable();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// intentionally does nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
|
||||
}
|
||||
|
||||
public ILogger Create(string name)
|
||||
public ILogger CreateLogger(string name)
|
||||
{
|
||||
return new TestLogger();
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
return new TestDisposable();
|
||||
}
|
||||
|
||||
public void Write(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
public void Log(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
|
|||
modeMatchResult.LogDetails(logger, tagHelper.Object, uniqueId, viewPath);
|
||||
|
||||
// Assert
|
||||
Mock.Get(logger).Verify(l => l.Write(
|
||||
Mock.Get(logger).Verify(l => l.Log(
|
||||
LogLevel.Verbose,
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<object>(),
|
||||
|
|
@ -51,13 +51,13 @@ namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
|
|||
modeMatchResult.LogDetails(logger, tagHelper.Object, uniqueId, viewPath);
|
||||
|
||||
// Assert
|
||||
Mock.Get(logger).Verify(l => l.Write(
|
||||
Mock.Get(logger).Verify(l => l.Log(
|
||||
LogLevel.Warning,
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<object>(),
|
||||
It.IsAny<Exception>(),
|
||||
It.IsAny<Func<object, Exception, string>>()), Times.Never);
|
||||
Mock.Get(logger).Verify(l => l.Write(
|
||||
Mock.Get(logger).Verify(l => l.Log(
|
||||
LogLevel.Verbose,
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<object>(),
|
||||
|
|
@ -82,13 +82,13 @@ namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
|
|||
modeMatchResult.LogDetails(logger, tagHelper.Object, uniqueId, viewPath);
|
||||
|
||||
// Assert
|
||||
Mock.Get(logger).Verify(l => l.Write(
|
||||
Mock.Get(logger).Verify(l => l.Log(
|
||||
LogLevel.Warning,
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<object>(),
|
||||
It.IsAny<Exception>(),
|
||||
It.IsAny<Func<object, Exception, string>>()), Times.Once);
|
||||
Mock.Get(logger).Verify(l => l.Write(
|
||||
Mock.Get(logger).Verify(l => l.Log(
|
||||
LogLevel.Verbose,
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<object>(),
|
||||
|
|
@ -113,13 +113,13 @@ namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
|
|||
modeMatchResult.LogDetails(logger, tagHelper.Object, uniqueId, viewPath);
|
||||
|
||||
// Assert
|
||||
Mock.Get(logger).Verify(l => l.Write(
|
||||
Mock.Get(logger).Verify(l => l.Log(
|
||||
LogLevel.Warning,
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<object>(),
|
||||
It.IsAny<Exception>(),
|
||||
It.IsAny<Func<object, Exception, string>>()), Times.Never);
|
||||
Mock.Get(logger).Verify(l => l.Write(
|
||||
Mock.Get(logger).Verify(l => l.Log(
|
||||
LogLevel.Verbose,
|
||||
It.IsAny<int>(),
|
||||
It.IsAny<object>(),
|
||||
|
|
|
|||
|
|
@ -260,9 +260,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
var loggerData0 = (PartialModeMatchLoggerStructure)logger.Logged[0].State;
|
||||
|
||||
Assert.Equal(LogLevel.Verbose, logger.Logged[1].LogLevel);
|
||||
Assert.IsAssignableFrom<ILoggerStructure>(logger.Logged[1].State);
|
||||
Assert.IsAssignableFrom<ILogValues>(logger.Logged[1].State);
|
||||
Assert.StartsWith("Skipping processing for Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper",
|
||||
((ILoggerStructure)logger.Logged[1].State).Format());
|
||||
((ILogValues)logger.Logged[1].State).Format());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -313,9 +313,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
Assert.Single(logger.Logged);
|
||||
|
||||
Assert.Equal(LogLevel.Verbose, logger.Logged[0].LogLevel);
|
||||
Assert.IsAssignableFrom<ILoggerStructure>(logger.Logged[0].State);
|
||||
Assert.IsAssignableFrom<ILogValues>(logger.Logged[0].State);
|
||||
Assert.StartsWith("Skipping processing for Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper",
|
||||
((ILoggerStructure)logger.Logged[0].State).Format());
|
||||
((ILogValues)logger.Logged[0].State).Format());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
return true;
|
||||
}
|
||||
|
||||
public void Write(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
public void Log(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
|
||||
{
|
||||
Logged.Add(new LoggerData(logLevel, state));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace ModelBindingWebSite
|
|||
|
||||
public DefaultCalculator(ILoggerFactory loggerFactory)
|
||||
{
|
||||
_logger = loggerFactory.Create(typeof(DefaultCalculator).FullName);
|
||||
_logger = loggerFactory.CreateLogger(typeof(DefaultCalculator).FullName);
|
||||
}
|
||||
|
||||
public int Operation(char @operator, int left, int right)
|
||||
|
|
@ -24,7 +24,7 @@ namespace ModelBindingWebSite
|
|||
case '*': return left * right;
|
||||
case '/': return left / right;
|
||||
default:
|
||||
_logger.WriteError("Unrecognized operator:" + @operator);
|
||||
_logger.LogError("Unrecognized operator:" + @operator);
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue