@@ -33,12 +33,7 @@ public IDisposable BeginScope<TState>(TState state) {
33
33
// a FormattedLogValues and ASP.NET provides multiple scope objects, so just use ToString()
34
34
string description = state . ToString ( ) ;
35
35
36
- // If there's data other than a simple string, it'll be added to the event
37
- object stateObj = state is string ? null : ( object ) state ;
38
-
39
- // Log scope creation as an event so that there is a parent to tie events together
40
36
var scope = new ExceptionlessLoggingScope ( description ) ;
41
- LogScope ( scope , stateObj ) ;
42
37
43
38
// Add to stack to support nesting within execution context
44
39
ExceptionlessLoggingScope . Push ( scope ) ;
@@ -103,7 +98,7 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
103
98
foreach ( KeyValuePair < string , object > prop in stateProps ) {
104
99
// Logging the message template is superfluous
105
100
if ( prop . Key != "{OriginalFormat}" )
106
- builder . AddObject ( prop . Value , prop . Key ) ;
101
+ builder . SetProperty ( prop . Key , prop . Value ) ;
107
102
}
108
103
} else {
109
104
// Otherwise, attach the entire object, using its type as the name
@@ -112,36 +107,5 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
112
107
113
108
builder . Submit ( ) ;
114
109
}
115
-
116
- /// <summary>
117
- /// Writes a scope creation entry.
118
- /// </summary>
119
- /// <param name="newScope">The <see cref="ExceptionlessLoggingScope"/> being created.</param>
120
- /// <param name="state"></param>
121
- private void LogScope ( ExceptionlessLoggingScope newScope , object state ) {
122
- var builder = _client . CreateLog ( $ "Creating scope: { newScope . Description } .", ExceptionlessLogLevel . Other ) ;
123
-
124
- // Set event reference id to that of scope object
125
- builder . SetReferenceId ( newScope . Id ) ;
126
-
127
- // If this is a nested scope, add parent's reference id
128
- if ( ExceptionlessLoggingScope . Current != null )
129
- builder . SetEventReference ( "Parent" , ExceptionlessLoggingScope . Current . Id ) ;
130
-
131
- if ( state != null ) {
132
- IEnumerable < KeyValuePair < string , object > > stateProps = state as IEnumerable < KeyValuePair < string , object > > ;
133
- if ( stateProps != null ) {
134
- foreach ( KeyValuePair < string , object > prop in stateProps ) {
135
- // Logging the message template is superfluous
136
- if ( prop . Key != "{OriginalFormat}" )
137
- builder . AddObject ( prop . Value , prop . Key ) ;
138
- }
139
- } else {
140
- builder . AddObject ( state ) ;
141
- }
142
- }
143
-
144
- builder . Submit ( ) ;
145
- }
146
110
}
147
111
}
0 commit comments