@ -20,7 +20,7 @@
# include <vector>
# include <vector>
# include <grpc/support/log.h>
# include "absl/log/log.h"
# include "src/core/lib/gprpp/crash.h"
# include "src/core/lib/gprpp/crash.h"
@ -86,23 +86,19 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName(
ServerReflectionResponse : : MessageResponseCase : : kErrorResponse ) {
ServerReflectionResponse : : MessageResponseCase : : kErrorResponse ) {
const ErrorResponse & error = response . error_response ( ) ;
const ErrorResponse & error = response . error_response ( ) ;
if ( error . error_code ( ) = = StatusCode : : NOT_FOUND ) {
if ( error . error_code ( ) = = StatusCode : : NOT_FOUND ) {
gpr_log ( GPR_INFO , " NOT_FOUND from server for FindFileByName(%s) " ,
LOG ( INFO ) < < " NOT_FOUND from server for FindFileByName( " < < filename
filename . c_str ( ) ) ;
< < " ) " ;
} else {
} else {
gpr_log ( GPR_INFO ,
LOG ( INFO ) < < " Error on FindFileByName( " < < filename
" Error on FindFileByName(%s) \n \t Error code: %d \n "
< < " ) \n \t Error code: " < < error . error_code ( )
" \t Error Message: %s " ,
< < " \n \t Error Message: " < < error . error_message ( ) ;
filename . c_str ( ) , error . error_code ( ) ,
error . error_message ( ) . c_str ( ) ) ;
}
}
} else {
} else {
gpr_log (
LOG ( INFO ) < < " Error on FindFileByName( " < < filename
GPR_INFO ,
< < " ) response type \n \t Expecting: "
" Error on FindFileByName(%s) response type \n "
< < ServerReflectionResponse : : MessageResponseCase : :
" \t Expecting: %d \n \t Received: %d " ,
kFileDescriptorResponse
filename . c_str ( ) ,
< < " \n \t Received: " < < response . message_response_case ( ) ;
ServerReflectionResponse : : MessageResponseCase : : kFileDescriptorResponse ,
response . message_response_case ( ) ) ;
}
}
return cached_db_ . FindFileByName ( filename , output ) ;
return cached_db_ . FindFileByName ( filename , output ) ;
@ -134,24 +130,19 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol(
const ErrorResponse & error = response . error_response ( ) ;
const ErrorResponse & error = response . error_response ( ) ;
if ( error . error_code ( ) = = StatusCode : : NOT_FOUND ) {
if ( error . error_code ( ) = = StatusCode : : NOT_FOUND ) {
missing_symbols_ . insert ( symbol_name ) ;
missing_symbols_ . insert ( symbol_name ) ;
gpr_log ( GPR_INFO ,
LOG ( INFO ) < < " NOT_FOUND from server for FindFileContainingSymbol( "
" NOT_FOUND from server for FindFileContainingSymbol(%s) " ,
< < symbol_name < < " ) " ;
symbol_name . c_str ( ) ) ;
} else {
} else {
gpr_log ( GPR_INFO ,
LOG ( INFO ) < < " Error on FindFileContainingSymbol( " < < symbol_name
" Error on FindFileContainingSymbol(%s) \n "
< < " ) \n \t Error code: " < < error . error_code ( )
" \t Error code: %d \n \t Error Message: %s " ,
< < " \n \t Error Message: " < < error . error_message ( ) ;
symbol_name . c_str ( ) , error . error_code ( ) ,
error . error_message ( ) . c_str ( ) ) ;
}
}
} else {
} else {
gpr_log (
LOG ( INFO ) < < " Error on FindFileContainingSymbol( " < < symbol_name
GPR_INFO ,
< < " ) response type \n \t Expecting: "
" Error on FindFileContainingSymbol(%s) response type \n "
< < ServerReflectionResponse : : MessageResponseCase : :
" \t Expecting: %d \n \t Received: %d " ,
kFileDescriptorResponse
symbol_name . c_str ( ) ,
< < " \n \t Received: " < < response . message_response_case ( ) ;
ServerReflectionResponse : : MessageResponseCase : : kFileDescriptorResponse ,
response . message_response_case ( ) ) ;
}
}
return cached_db_ . FindFileContainingSymbol ( symbol_name , output ) ;
return cached_db_ . FindFileContainingSymbol ( symbol_name , output ) ;
}
}
@ -167,7 +158,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension(
if ( missing_extensions_ . find ( containing_type ) ! = missing_extensions_ . end ( ) & &
if ( missing_extensions_ . find ( containing_type ) ! = missing_extensions_ . end ( ) & &
missing_extensions_ [ containing_type ] . find ( field_number ) ! =
missing_extensions_ [ containing_type ] . find ( field_number ) ! =
missing_extensions_ [ containing_type ] . end ( ) ) {
missing_extensions_ [ containing_type ] . end ( ) ) {
gpr_log ( GPR_INFO , " nested map. " ) ;
LOG ( INFO ) < < " nested map. " ;
return false ;
return false ;
}
}
@ -194,24 +185,20 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension(
missing_extensions_ [ containing_type ] = { } ;
missing_extensions_ [ containing_type ] = { } ;
}
}
missing_extensions_ [ containing_type ] . insert ( field_number ) ;
missing_extensions_ [ containing_type ] . insert ( field_number ) ;
gpr_log ( GPR_INFO ,
LOG ( INFO ) < < " NOT_FOUND from server for FindFileContainingExtension( "
" NOT_FOUND from server for FindFileContainingExtension(%s, %d) " ,
< < containing_type < < " , " < < field_number < < " ) " ;
containing_type . c_str ( ) , field_number ) ;
} else {
} else {
gpr_log ( GPR_INFO ,
LOG ( INFO ) < < " Error on FindFileContainingExtension( " < < containing_type
" Error on FindFileContainingExtension(%s, %d) \n "
< < " , " < < field_number
" \t Error code: %d \n \t Error Message: %s " ,
< < " ) \n \t Error code: " < < error . error_code ( )
containing_type . c_str ( ) , field_number , error . error_code ( ) ,
< < " \n \t Error Message: " < < error . error_message ( ) ;
error . error_message ( ) . c_str ( ) ) ;
}
}
} else {
} else {
gpr_log (
LOG ( INFO ) < < " Error on FindFileContainingExtension( " < < containing_type
GPR_INFO ,
< < " , " < < field_number < < " ) response type \n \t Expecting: "
" Error on FindFileContainingExtension(%s, %d) response type \n "
< < ServerReflectionResponse : : MessageResponseCase : :
" \t Expecting: %d \n \t Received: %d " ,
kFileDescriptorResponse
containing_type . c_str ( ) , field_number ,
< < " \n \t Received: " < < response . message_response_case ( ) ;
ServerReflectionResponse : : MessageResponseCase : : kFileDescriptorResponse ,
response . message_response_case ( ) ) ;
}
}
return cached_db_ . FindFileContainingExtension ( containing_type , field_number ,
return cached_db_ . FindFileContainingExtension ( containing_type , field_number ,
@ -245,14 +232,12 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers(
ServerReflectionResponse : : MessageResponseCase : : kErrorResponse ) {
ServerReflectionResponse : : MessageResponseCase : : kErrorResponse ) {
const ErrorResponse & error = response . error_response ( ) ;
const ErrorResponse & error = response . error_response ( ) ;
if ( error . error_code ( ) = = StatusCode : : NOT_FOUND ) {
if ( error . error_code ( ) = = StatusCode : : NOT_FOUND ) {
gpr_log ( GPR_INFO , " NOT_FOUND from server for FindAllExtensionNumbers(%s) " ,
LOG ( INFO ) < < " NOT_FOUND from server for FindAllExtensionNumbers( "
extendee_type . c_str ( ) ) ;
< < extendee_type < < " ) " ;
} else {
} else {
gpr_log ( GPR_INFO ,
LOG ( INFO ) < < " Error on FindAllExtensionNumbersExtension( " < < extendee_type
" Error on FindAllExtensionNumbersExtension(%s) \n "
< < " ) \n \t Error code: " < < error . error_code ( )
" \t Error code: %d \n \t Error Message: %s " ,
< < " \n \t Error Message: " < < error . error_message ( ) ;
extendee_type . c_str ( ) , error . error_code ( ) ,
error . error_message ( ) . c_str ( ) ) ;
}
}
}
}
return false ;
return false ;
@ -278,16 +263,13 @@ bool ProtoReflectionDescriptorDatabase::GetServices(
} else if ( response . message_response_case ( ) = =
} else if ( response . message_response_case ( ) = =
ServerReflectionResponse : : MessageResponseCase : : kErrorResponse ) {
ServerReflectionResponse : : MessageResponseCase : : kErrorResponse ) {
const ErrorResponse & error = response . error_response ( ) ;
const ErrorResponse & error = response . error_response ( ) ;
gpr_log ( GPR_INFO ,
LOG ( INFO ) < < " Error on GetServices() \n \t Error code: " < < error . error_code ( )
" Error on GetServices() \n \t Error code: %d \n "
< < " \n \t Error Message: " < < error . error_message ( ) ;
" \t Error Message: %s " ,
error . error_code ( ) , error . error_message ( ) . c_str ( ) ) ;
} else {
} else {
gpr_log (
LOG ( INFO )
GPR_INFO ,
< < " Error on GetServices() response type \n \t Expecting: "
" Error on GetServices() response type \n \t Expecting: %d \n \t Received: %d " ,
< < ServerReflectionResponse : : MessageResponseCase : : kListServicesResponse
ServerReflectionResponse : : MessageResponseCase : : kListServicesResponse ,
< < " \n \t Received: " < < response . message_response_case ( ) ;
response . message_response_case ( ) ) ;
}
}
return false ;
return false ;
}
}