/// <summary> /// Adds services required for client-side logging endpoint /// </summary> public static ILoupeAgentBuilder AddClientLogging(this ILoupeAgentBuilder builder) { builder.Services.AddMemoryCache(); builder.Services.AddSingleton <RequestProcessor>(); builder.Services.AddSingleton <ILoupeLog, DefaultLoupeLog>(); builder.Services.AddSingleton <JavaScriptLogger>(); return(builder); }
/// <summary> /// Adds ASP.NET Core diagnostic listeners for standard Loupe metric generation. /// </summary> /// <param name="builder">The <see cref="ILoupeAgentBuilder"/> instance.</param> /// <param name="principalFunc">The function to use for IPrincipal resolution</param> /// <param name="applicationUserFunc">Optional. The function to use for application user mapping from an IPrincipal</param> /// <returns>The <see cref="ILoupeAgentBuilder"/> instance.</returns> public static ILoupeAgentBuilder AddAspNetCoreDiagnostics(this ILoupeAgentBuilder builder, Func <IPrincipal>?principalFunc, Func <IPrincipal, Lazy <ApplicationUser>, bool>?applicationUserFunc = null) { builder = builder.AddListener <ActionDiagnosticListener>(); builder = (principalFunc == null) ? builder.AddPrincipalResolver <ClaimsPrincipalResolver>() : builder; builder = (applicationUserFunc == null) ? builder.AddApplicationUserProvider <ClaimsPrincipalApplicationUserProvider>() : builder.AddApplicationUserProvider(applicationUserFunc); return(builder); }
/// <summary> /// Adds the EF Core diagnostic listener. /// </summary> /// <param name="builder">The <see cref="ILoupeAgentBuilder"/>.</param> /// <returns>The builder.</returns> public static ILoupeAgentBuilder AddEntityFrameworkCoreDiagnostics(this ILoupeAgentBuilder builder) => builder.AddListener <EntityFrameworkCoreDiagnosticListener>();
/// <summary> /// Add performance counter monitoring to the Loupe Agent /// </summary> /// <param name="builder"></param> /// <returns>The Loupe Agent Builder</returns> public static ILoupeAgentBuilder AddPerformanceCounters(this ILoupeAgentBuilder builder) => builder.AddMonitor <PerformanceMonitor>();
/// <summary> /// Adds ASP.NET Core diagnostic listeners for standard Loupe metric generation. /// </summary> /// <param name="builder">The <see cref="ILoupeAgentBuilder"/> instance.</param> /// <param name="applicationUserFunc">The function to use for application user mapping from an IPrincipal</param> /// <returns>The <see cref="ILoupeAgentBuilder"/> instance.</returns> public static ILoupeAgentBuilder AddAspNetCoreDiagnostics(this ILoupeAgentBuilder builder, Func <IPrincipal, Lazy <ApplicationUser>, bool> applicationUserFunc) { return(AddAspNetCoreDiagnostics(builder, null, applicationUserFunc)); }
/// <summary> /// Adds ASP.NET Core diagnostic listeners for standard Loupe metric generation. /// </summary> /// <param name="builder">The <see cref="ILoupeAgentBuilder"/> instance.</param> /// <returns>The <see cref="ILoupeAgentBuilder"/> instance.</returns> public static ILoupeAgentBuilder AddAspNetCoreDiagnostics(this ILoupeAgentBuilder builder) => builder.AddListener <ActionDiagnosticListener>() .AddPrincipalResolver <ClaimsPrincipalResolver>() .AddApplicationUserProvider <ClaimsPrincipalApplicationUserProvider>();