Reacting to ILogger api changes
This commit is contained in:
parent
5c29efc49c
commit
9330789fe3
|
|
@ -47,10 +47,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Whether the action constraint is an <see cref="IActionConstraintFactory"/>.
|
||||
/// </summary>
|
||||
public bool IsFactory { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -117,10 +117,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// See <see cref="ControllerActionDescriptor.ControllerTypeInfo"/>.
|
||||
/// </summary>
|
||||
public TypeInfo ControllerTypeInfo { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -91,10 +91,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Gets the set of properties associated with the action <see cref="ActionModel.Properties"/>.
|
||||
/// </summary>
|
||||
public IDictionary<object, object> Properties { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,10 +29,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// See <see cref="ApiExplorerModel.GroupName"/>.
|
||||
/// </summary>
|
||||
public string GroupName { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,10 +37,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Whether or not the assembly is dynamic. See <see cref="Assembly.IsDynamic"/>.
|
||||
/// </summary>
|
||||
public bool IsDynamic { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// The name of the route. See <see cref="AttributeRouteInfo.Name"/>.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,10 +42,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Whether or not the template is absolute. See <see cref="AttributeRouteModel.IsAbsoluteTemplate"/>.
|
||||
/// </summary>
|
||||
public bool IsAbsoluteTemplate { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94,10 +94,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// Gets the set of properties associated with the controller <see cref="ControllerModel.Properties"/>.
|
||||
/// </summary>
|
||||
public IDictionary<object, object> Properties { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,10 +34,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// The filter scope. See <see cref="FilterDescriptor.Scope"/>.
|
||||
/// </summary>
|
||||
public int Scope { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -60,10 +60,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// A list of interfaces the <see cref="IFilter"/> implements.
|
||||
/// </summary>
|
||||
public IList<Type> FilterInterfaces { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,10 +28,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// The <see cref="Type"/> of the parameter. See <see cref="ParameterDescriptor.ParameterType"/>.
|
||||
/// </summary>
|
||||
public Type ParameterType { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,10 +30,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// The <see cref="Type"/> of the parameter.
|
||||
/// </summary>
|
||||
public Type ParameterType { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,10 +30,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// The <see cref="Type"/> of the property.
|
||||
/// </summary>
|
||||
public Type PropertyType { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -39,10 +39,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// See <see cref="IRouteConstraintProvider.BlockNonAttributedActions"/>.
|
||||
/// </summary>
|
||||
public bool BlockNonAttributedActions { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,5 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
/// The <see cref="RouteKeyHandling"/>. See <see cref="RouteDataActionConstraint.KeyHandling"/>.
|
||||
/// </summary>
|
||||
public RouteKeyHandling KeyHandling { get; }
|
||||
|
||||
public override string Format()
|
||||
{
|
||||
return LogFormatter.FormatLogValues(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -44,13 +44,13 @@ namespace Microsoft.AspNet.Mvc
|
|||
Assert.Equal(1, sink.Scopes.Count);
|
||||
var scope = sink.Scopes[0];
|
||||
Assert.Equal(typeof(DefaultActionSelector).FullName, scope.LoggerName);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", scope.Scope);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", scope.Scope.ToString());
|
||||
|
||||
Assert.Equal(1, sink.Writes.Count);
|
||||
|
||||
var write = sink.Writes[0];
|
||||
Assert.Equal(typeof(DefaultActionSelector).FullName, write.LoggerName);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", write.Scope);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<DefaultActionSelectorSelectAsyncValues>(write.State);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", values.Name);
|
||||
Assert.Empty(values.ActionsMatchingRouteConstraints);
|
||||
|
|
@ -95,13 +95,13 @@ namespace Microsoft.AspNet.Mvc
|
|||
Assert.Equal(1, sink.Scopes.Count);
|
||||
var scope = sink.Scopes[0];
|
||||
Assert.Equal(typeof(DefaultActionSelector).FullName, scope.LoggerName);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", scope.Scope);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", scope.Scope.ToString());
|
||||
|
||||
Assert.Equal(1, sink.Writes.Count);
|
||||
|
||||
var write = sink.Writes[0];
|
||||
Assert.Equal(typeof(DefaultActionSelector).FullName, write.LoggerName);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", write.Scope);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<DefaultActionSelectorSelectAsyncValues>(write.State);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", values.Name);
|
||||
Assert.Equal<ActionDescriptor>(actions, values.ActionsMatchingRouteConstraints);
|
||||
|
|
@ -137,13 +137,13 @@ namespace Microsoft.AspNet.Mvc
|
|||
Assert.Equal(1, sink.Scopes.Count);
|
||||
var scope = sink.Scopes[0];
|
||||
Assert.Equal(typeof(DefaultActionSelector).FullName, scope.LoggerName);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", scope.Scope);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", scope.Scope.ToString());
|
||||
|
||||
Assert.Equal(1, sink.Writes.Count);
|
||||
|
||||
var write = sink.Writes[0];
|
||||
Assert.Equal(typeof(DefaultActionSelector).FullName, write.LoggerName);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", write.Scope);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<DefaultActionSelectorSelectAsyncValues>(write.State);
|
||||
Assert.Equal("DefaultActionSelector.SelectAsync", values.Name);
|
||||
Assert.Equal<ActionDescriptor>(actions, values.ActionsMatchingRouteConstraints);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
public static NullLogger Instance = new NullLogger();
|
||||
|
||||
public IDisposable BeginScope(object state)
|
||||
public IDisposable BeginScopeImpl(object state)
|
||||
{
|
||||
return NullDisposable.Instance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
public string Name { get; set; }
|
||||
|
||||
public IDisposable BeginScope(object state)
|
||||
public IDisposable BeginScopeImpl(object state)
|
||||
{
|
||||
_scope = state;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ namespace Microsoft.AspNet.Mvc
|
|||
// Assert
|
||||
var scope = Assert.Single(sink.Scopes);
|
||||
Assert.Equal(typeof(MvcRouteHandler).FullName, scope.LoggerName);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", scope.Scope);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", scope.Scope.ToString());
|
||||
|
||||
var write = Assert.Single(sink.Writes);
|
||||
Assert.Equal(typeof(MvcRouteHandler).FullName, write.LoggerName);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", write.Scope);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<MvcRouteHandlerRouteAsyncValues>(write.State);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", values.Name);
|
||||
Assert.True(values.ActionSelected);
|
||||
|
|
@ -69,11 +69,11 @@ namespace Microsoft.AspNet.Mvc
|
|||
// Assert
|
||||
var scope = Assert.Single(sink.Scopes);
|
||||
Assert.Equal(typeof(MvcRouteHandler).FullName, scope.LoggerName);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", scope.Scope);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", scope.Scope.ToString());
|
||||
|
||||
var write = Assert.Single(sink.Writes);
|
||||
Assert.Equal(typeof(MvcRouteHandler).FullName, write.LoggerName);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", write.Scope);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<MvcRouteHandlerRouteAsyncValues>(write.State);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", values.Name);
|
||||
Assert.False(values.ActionSelected);
|
||||
|
|
@ -105,13 +105,13 @@ namespace Microsoft.AspNet.Mvc
|
|||
// Assert
|
||||
var scope = Assert.Single(sink.Scopes);
|
||||
Assert.Equal(typeof(MvcRouteHandler).FullName, scope.LoggerName);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", scope.Scope);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", scope.Scope.ToString());
|
||||
|
||||
Assert.Equal(1, sink.Writes.Count);
|
||||
|
||||
var write = sink.Writes[0];
|
||||
Assert.Equal(typeof(MvcRouteHandler).FullName, write.LoggerName);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", write.Scope);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<MvcRouteHandlerRouteAsyncValues>(write.State);
|
||||
Assert.Equal("MvcRouteHandler.RouteAsync", values.Name);
|
||||
Assert.True(values.ActionSelected);
|
||||
|
|
|
|||
|
|
@ -926,13 +926,13 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
Assert.Equal(1, sink.Scopes.Count);
|
||||
var scope = sink.Scopes[0];
|
||||
Assert.Equal(typeof(AttributeRoute).FullName, scope.LoggerName);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", scope.Scope);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", scope.Scope.ToString());
|
||||
|
||||
Assert.Equal(1, sink.Writes.Count);
|
||||
|
||||
var write = sink.Writes[0];
|
||||
Assert.Equal(typeof(AttributeRoute).FullName, write.LoggerName);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", write.Scope);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<AttributeRouteRouteAsyncValues>(write.State);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", values.Name);
|
||||
Assert.True(values.Handled);
|
||||
|
|
@ -957,13 +957,13 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
Assert.Equal(1, sink.Scopes.Count);
|
||||
var scope = sink.Scopes[0];
|
||||
Assert.Equal(typeof(AttributeRoute).FullName, scope.LoggerName);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", scope.Scope);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", scope.Scope.ToString());
|
||||
|
||||
Assert.Equal(1, sink.Writes.Count);
|
||||
|
||||
var write = sink.Writes[0];
|
||||
Assert.Equal(typeof(AttributeRoute).FullName, write.LoggerName);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", write.Scope);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", write.Scope.ToString());
|
||||
var values = Assert.IsType<AttributeRouteRouteAsyncValues>(write.State);
|
||||
Assert.Equal("AttributeRoute.RouteAsync", values.Name);
|
||||
Assert.False(values.Handled);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
// Assert
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
|
||||
|
||||
var logs = await GetLogsAsync(client, requestTraceId);
|
||||
var scopeNode = logs.FindScope(nameof(MvcRouteHandler) + ".RouteAsync");
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
|||
return false;
|
||||
}
|
||||
|
||||
public IDisposable BeginScope(object scope)
|
||||
public IDisposable BeginScopeImpl(object scope)
|
||||
{
|
||||
return new TestDisposable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
Assert.Equal(LogLevel.Verbose, logger.Logged[1].LogLevel);
|
||||
Assert.IsAssignableFrom<ILogValues>(logger.Logged[1].State);
|
||||
Assert.StartsWith("Skipping processing for Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper",
|
||||
((ILogValues)logger.Logged[1].State).Format());
|
||||
((ILogValues)logger.Logged[1].State).ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -422,7 +422,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
Assert.Equal(LogLevel.Verbose, logger.Logged[0].LogLevel);
|
||||
Assert.IsAssignableFrom<ILogValues>(logger.Logged[0].State);
|
||||
Assert.StartsWith("Skipping processing for Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper",
|
||||
((ILogValues)logger.Logged[0].State).Format());
|
||||
((ILogValues)logger.Logged[0].State).ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
{
|
||||
public List<LoggerData> Logged { get; } = new List<LoggerData>();
|
||||
|
||||
public IDisposable BeginScope(object state)
|
||||
public IDisposable BeginScopeImpl(object state)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace LoggingWebSite
|
|||
private void CopyScopeNodeTree(ScopeNode root, ScopeNodeDto rootDto)
|
||||
{
|
||||
rootDto.LoggerName = root.Name;
|
||||
rootDto.State = root.State;
|
||||
rootDto.State = root.State?.ToString();
|
||||
rootDto.StateType = root.State?.GetType();
|
||||
|
||||
foreach (var logInfo in root.Messages)
|
||||
|
|
|
|||
Loading…
Reference in New Issue