5
5
using System . Collections . Generic ;
6
6
using System . Threading ;
7
7
using Microsoft . AspNet . Http ;
8
- using Microsoft . AspNet . Http . Features ;
9
8
using Microsoft . Extensions . Logging ;
10
9
11
10
namespace Microsoft . AspNet . Hosting . Internal
@@ -47,29 +46,24 @@ private class HostingRequestScope : ILogValues
47
46
{
48
47
private readonly HttpContext _httpContext ;
49
48
50
- private FeatureReference < IHttpRequestIdentifierFeature > _requestIdentifierFeatureReference ;
51
- private IEnumerable < KeyValuePair < string , object > > _cachedGetValues ;
52
49
private string _cachedToString ;
50
+ private IEnumerable < KeyValuePair < string , object > > _cachedGetValues ;
53
51
54
52
public HostingRequestScope ( HttpContext httpContext )
55
53
{
56
54
_httpContext = httpContext ;
57
55
}
58
56
59
- public IHttpRequestIdentifierFeature RequestIdFeature =>
60
- _requestIdentifierFeatureReference . Fetch ( _httpContext . Features ) ??
61
- _requestIdentifierFeatureReference . Update ( _httpContext . Features , new FastHttpRequestIdentifierFeature ( ) ) ;
62
-
63
57
public override string ToString ( ) => _cachedToString ?? Interlocked . CompareExchange (
64
58
ref _cachedToString ,
65
- $ "RequestId:{ RequestIdFeature . TraceIdentifier } RequestPath:{ _httpContext . Request . Path } ",
59
+ $ "RequestId:{ _httpContext . TraceIdentifier } RequestPath:{ _httpContext . Request . Path } ",
66
60
null ) ;
67
61
68
62
public IEnumerable < KeyValuePair < string , object > > GetValues ( ) => _cachedGetValues ?? Interlocked . CompareExchange (
69
63
ref _cachedGetValues ,
70
64
new [ ]
71
65
{
72
- new KeyValuePair < string , object > ( "RequestId" , RequestIdFeature . TraceIdentifier ) ,
66
+ new KeyValuePair < string , object > ( "RequestId" , _httpContext . TraceIdentifier ) ,
73
67
new KeyValuePair < string , object > ( "RequestPath" , _httpContext . Request . Path . ToString ( ) ) ,
74
68
} ,
75
69
null ) ;
@@ -80,8 +74,9 @@ private class HostingRequestStarting : ILogValues
80
74
internal static readonly Func < object , Exception , string > Callback = ( state , exception ) => ( ( HostingRequestStarting ) state ) . ToString ( ) ;
81
75
82
76
private readonly HttpContext _httpContext ;
83
- private IEnumerable < KeyValuePair < string , object > > _cachedGetValues ;
77
+
84
78
private string _cachedToString ;
79
+ private IEnumerable < KeyValuePair < string , object > > _cachedGetValues ;
85
80
86
81
public HostingRequestStarting ( HttpContext httpContext )
87
82
{
@@ -116,6 +111,7 @@ private class HostingRequestFinished
116
111
internal static readonly Func < object , Exception , string > Callback = ( state , exception ) => ( ( HostingRequestFinished ) state ) . ToString ( ) ;
117
112
118
113
private readonly HttpContext _httpContext ;
114
+
119
115
private IEnumerable < KeyValuePair < string , object > > _cachedGetValues ;
120
116
private string _cachedToString ;
121
117
0 commit comments