From da2a0cb3506fa9a184dee30c02b237d804aee1de Mon Sep 17 00:00:00 2001 From: behnam Date: Sun, 14 Nov 2021 12:00:10 +0330 Subject: [PATCH] Add ability to choose showing log detail while registering grpc service --- .idea/.idea.Azihub.Appstract/.idea/indexLayout.xml | 2 +- Azihub.Appstract.Grpc/Extensions/GrpcExtensions.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.idea/.idea.Azihub.Appstract/.idea/indexLayout.xml b/.idea/.idea.Azihub.Appstract/.idea/indexLayout.xml index 27ba142..7b08163 100644 --- a/.idea/.idea.Azihub.Appstract/.idea/indexLayout.xml +++ b/.idea/.idea.Azihub.Appstract/.idea/indexLayout.xml @@ -1,6 +1,6 @@ - + diff --git a/Azihub.Appstract.Grpc/Extensions/GrpcExtensions.cs b/Azihub.Appstract.Grpc/Extensions/GrpcExtensions.cs index c3d8ecf..96fcd87 100644 --- a/Azihub.Appstract.Grpc/Extensions/GrpcExtensions.cs +++ b/Azihub.Appstract.Grpc/Extensions/GrpcExtensions.cs @@ -11,13 +11,15 @@ public static class GrpcExtensions /// This extension adds the CodeFirstGrpc and CodeFirstGrpcReflection service methods and registers the AppsAuthRpcExceptionsInterceptor class. /// /// + /// /// - public static IServiceCollection AddAndConfigureCodeFirstGrpc(this IServiceCollection services) + public static IServiceCollection AddAndConfigureCodeFirstGrpc(this IServiceCollection services, bool enableDetailedErrors = false) { services.AddCodeFirstGrpc(config => { config.Interceptors.Add(typeof(RpcExceptionsInterceptor)); config.ResponseCompressionLevel = System.IO.Compression.CompressionLevel.Optimal; + config.EnableDetailedErrors = enableDetailedErrors; }); services.TryAddSingleton(RpcExceptionsInterceptor.Instance);