@@ -36,9 +36,9 @@ public MiscRegistry()
3636
3737 this . AddSingleton < Func < String , String > > ( container => serviceName => { return ConfigurationReader . GetBaseServerUri ( serviceName ) . OriginalString ; } ) ;
3838
39- bool logRequests = ConfigurationReaderExtensions . GetValueOrDefault < Boolean > ( "MiddlewareLogging" , "LogRequests" , true ) ;
40- bool logResponses = ConfigurationReaderExtensions . GetValueOrDefault < Boolean > ( "MiddlewareLogging" , "LogResponses" , true ) ;
41- LogLevel middlewareLogLevel = ConfigurationReaderExtensions . GetValueOrDefault < LogLevel > ( "MiddlewareLogging" , "MiddlewareLogLevel" , LogLevel . Warning ) ;
39+ bool logRequests = ConfigurationReader . GetValueOrDefault < Boolean > ( "MiddlewareLogging" , "LogRequests" , true ) ;
40+ bool logResponses = ConfigurationReader . GetValueOrDefault < Boolean > ( "MiddlewareLogging" , "LogResponses" , true ) ;
41+ LogLevel middlewareLogLevel = ConfigurationReader . GetValueOrDefault < LogLevel > ( "MiddlewareLogging" , "MiddlewareLogLevel" , LogLevel . Warning ) ;
4242
4343 RequestResponseMiddlewareLoggingConfig config =
4444 new RequestResponseMiddlewareLoggingConfig ( middlewareLogLevel , logRequests , logResponses ) ;
@@ -48,26 +48,4 @@ public MiscRegistry()
4848
4949 #endregion
5050 }
51-
52- public static class ConfigurationReaderExtensions
53- {
54- public static T GetValueOrDefault < T > ( String sectionName , String keyName , T defaultValue )
55- {
56- try
57- {
58- var value = ConfigurationReader . GetValue ( sectionName , keyName ) ;
59-
60- if ( String . IsNullOrEmpty ( value ) )
61- {
62- return defaultValue ;
63- }
64-
65- return ( T ) Convert . ChangeType ( value , typeof ( T ) ) ;
66- }
67- catch ( KeyNotFoundException kex )
68- {
69- return defaultValue ;
70- }
71- }
72- }
7351}
0 commit comments