@@ -41,6 +41,17 @@ public static IWebHostBuilder UseSentry(this IWebHostBuilder builder, string dsn
41
41
public static IWebHostBuilder UseSentry (
42
42
this IWebHostBuilder builder ,
43
43
Action < SentryAspNetCoreOptions > configureOptions )
44
+ => builder . UseSentry ( ( context , options ) => configureOptions ? . Invoke ( options ) ) ;
45
+
46
+ /// <summary>
47
+ /// Uses Sentry integration.
48
+ /// </summary>
49
+ /// <param name="builder">The builder.</param>
50
+ /// <param name="configureOptions">The configure options.</param>
51
+ /// <returns></returns>
52
+ public static IWebHostBuilder UseSentry (
53
+ this IWebHostBuilder builder ,
54
+ Action < WebHostBuilderContext , SentryAspNetCoreOptions > configureOptions )
44
55
{
45
56
// The earliest we can hook the SDK initialization code with the framework
46
57
// Initialization happens at a later time depending if the default MEL backend is enabled or not.
@@ -54,7 +65,10 @@ public static IWebHostBuilder UseSentry(
54
65
55
66
if ( configureOptions != null )
56
67
{
57
- logging . Services . Configure ( configureOptions ) ;
68
+ logging . Services . Configure < SentryAspNetCoreOptions > ( options =>
69
+ {
70
+ configureOptions ( context , options ) ;
71
+ } ) ;
58
72
}
59
73
60
74
logging . Services . AddSingleton < IConfigureOptions < SentryAspNetCoreOptions > , SentryAspNetCoreOptionsSetup > ( ) ;
0 commit comments