Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Changelog

## Unreleased

### Fixes

- Experimental _Structured Logs_:
- Remove `IDisposable` from `SentryStructuredLogger`. Disposal is intended through the owning `IHub` instance. ([#4424](https://github.com/getsentry/sentry-dotnet/pull/4424))
- Ensure all buffered logs are sent to Sentry when the application terminates unexpectedly. ([#4425](https://github.com/getsentry/sentry-dotnet/pull/4425))

## 5.14.1

### Fixes

- Crontabs now support day names (MON-SUN) and allow step values and ranges to be combined ([#4407](https://github.com/getsentry/sentry-dotnet/pull/4407))
- Ensure the correct Sentry Cocoa SDK framework version is used on iOS ([#4411](https://github.com/getsentry/sentry-dotnet/pull/4411))
- Experimental _Structured Logs_:
- Remove `IDisposable` from `SentryStructuredLogger`. Disposal is intended through the owning `IHub` instance. ([#4424](https://github.com/getsentry/sentry-dotnet/pull/4424))

### Dependencies

Expand Down
1 change: 1 addition & 0 deletions src/Sentry/Internal/Hub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ public async Task FlushAsync(TimeSpan timeout)
{
try
{
Logger.Flush();
await CurrentClient.FlushAsync(timeout).ConfigureAwait(false);
}
catch (Exception e)
Expand Down
30 changes: 30 additions & 0 deletions test/Sentry.Tests/HubTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,31 @@ public void Logger_DisableAfterCreate_HasNoEffect()
hub.Logger.Should().BeOfType<DefaultSentryStructuredLogger>();
}

[Fact]
public async Task Logger_FlushAsync_DoesCaptureLog()
{
// Arrange
_fixture.Options.Experimental.EnableLogs = true;
var hub = _fixture.GetSut();

// Act
hub.Logger.LogWarning("Message");
await hub.FlushAsync();

// Assert
_fixture.Client.Received(1).CaptureEnvelope(
Arg.Is<Envelope>(envelope =>
envelope.Items.Single(item => item.Header["type"].Equals("log")).Payload.GetType().IsAssignableFrom(typeof(JsonSerializable))
)
);
await _fixture.Client.Received(1).FlushAsync(
Arg.Is<TimeSpan>(timeout =>
timeout.Equals(_fixture.Options.FlushTimeout)
)
);
hub.Logger.Should().BeOfType<DefaultSentryStructuredLogger>();
}

[Fact]
public void Logger_Dispose_DoesCaptureLog()
{
Expand All @@ -1641,6 +1666,11 @@ public void Logger_Dispose_DoesCaptureLog()
envelope.Items.Single(item => item.Header["type"].Equals("log")).Payload.GetType().IsAssignableFrom(typeof(JsonSerializable))
)
);
_fixture.Client.Received(1).FlushAsync(
Arg.Is<TimeSpan>(timeout =>
timeout.Equals(_fixture.Options.ShutdownTimeout)
)
);
hub.Logger.Should().BeOfType<DefaultSentryStructuredLogger>();
}

Expand Down
Loading