Skip to content

Commit 8c919d2

Browse files
committed
Removed the logging scope as it was creating ton of noise
We may need to revisit this.
1 parent 7dc4f1d commit 8c919d2

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLogger.cs

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ public IDisposable BeginScope<TState>(TState state) {
3333
// a FormattedLogValues and ASP.NET provides multiple scope objects, so just use ToString()
3434
string description = state.ToString();
3535

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
4036
var scope = new ExceptionlessLoggingScope(description);
41-
LogScope(scope, stateObj);
4237

4338
// Add to stack to support nesting within execution context
4439
ExceptionlessLoggingScope.Push(scope);
@@ -103,7 +98,7 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
10398
foreach (KeyValuePair<string, object> prop in stateProps) {
10499
// Logging the message template is superfluous
105100
if (prop.Key != "{OriginalFormat}")
106-
builder.AddObject(prop.Value, prop.Key);
101+
builder.SetProperty(prop.Key, prop.Value);
107102
}
108103
} else {
109104
// 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
112107

113108
builder.Submit();
114109
}
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-
}
146110
}
147111
}

src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLoggerProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public class ExceptionlessLoggerProvider : ILoggerProvider {
1111
/// </summary>
1212
public ExceptionlessLoggerProvider(ExceptionlessClient client) {
1313
_client = client ?? throw new ArgumentNullException(nameof(client));
14-
_shouldDispose = false;
1514
}
1615

1716
/// <summary>

0 commit comments

Comments
 (0)