Skip to content

Commit 7624baa

Browse files
committed
feat(logs): Sentry.Maui
1 parent 1bc3a6f commit 7624baa

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

samples/Sentry.Samples.Maui/MauiProgram.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public static MauiApp CreateMauiApp()
2323
options.AttachScreenshot = true;
2424

2525
options.Debug = true;
26+
options.EnableLogs = true;
2627
options.SampleRate = 1.0F;
2728

2829
#if __ANDROID__
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.Extensions.Logging;
2+
using Microsoft.Extensions.Options;
3+
using Sentry.Extensions.Logging;
4+
5+
namespace Sentry.Maui.Internal;
6+
7+
[ProviderAlias("SentryLogs")]
8+
[Experimental(Infrastructure.DiagnosticId.ExperimentalFeature)]
9+
internal sealed class SentryMauiStructuredLoggerProvider : SentryStructuredLoggerProvider
10+
{
11+
public SentryMauiStructuredLoggerProvider(IOptions<SentryMauiOptions> options, IHub hub)
12+
: base(options, hub)
13+
{
14+
}
15+
}

src/Sentry.Maui/SentryMauiAppBuilderExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public static MauiAppBuilder UseSentry(this MauiAppBuilder builder,
5151

5252
services.AddLogging();
5353
services.AddSingleton<ILoggerProvider, SentryMauiLoggerProvider>();
54+
services.AddSingleton<ILoggerProvider, SentryMauiStructuredLoggerProvider>();
5455
services.AddSingleton<IMauiInitializeService, SentryMauiInitializer>();
5556
services.AddSingleton<IConfigureOptions<SentryMauiOptions>, SentryMauiOptionsSetup>();
5657
services.AddSingleton<Disposer>();

0 commit comments

Comments
 (0)