diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 022be5fec46..9329c61bf27 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -332,7 +332,7 @@ typedef struct { #define GRPC_ARG_PER_RPC_RETRY_BUFFER_SIZE "grpc.per_rpc_retry_buffer_size" /** Channel arg that carries the bridged objective c object for custom metrics * logging filter. */ -#define GRPC_ARG_MOBILE_LOG_CONFIG "grpc.mobile_log_config" +#define GRPC_ARG_MOBILE_LOG_CONTEXT "grpc.mobile_log_context" /** If non-zero, client authority filter is disabled for the channel */ #define GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER \ "grpc.disable_client_authority_filter" diff --git a/src/objective-c/GRPCClient/GRPCCall+MobileLog.h b/src/objective-c/GRPCClient/GRPCCall+MobileLog.h deleted file mode 100644 index 53b347d9cad..00000000000 --- a/src/objective-c/GRPCClient/GRPCCall+MobileLog.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCCall.h" - -@interface GRPCCall (MobileLog) -// Set the object to be passed down along channel stack with channel arg -// GRPC_ARG_MOBILE_LOG_CONFIG. The setting may be used by custom channel -// filters for metrics logging. -+ (void)setLogConfig:(id)logConfig; - -// Obtain the object to be passed down along channel stack with channel arg -// GRPC_ARG_MOBILE_LOG_CONFIG. -+ (id)logConfig; -@end diff --git a/src/objective-c/GRPCClient/GRPCCall+MobileLog.m b/src/objective-c/GRPCClient/GRPCCall+MobileLog.m deleted file mode 100644 index 4dedb7de8bb..00000000000 --- a/src/objective-c/GRPCClient/GRPCCall+MobileLog.m +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCCall+MobileLog.h" - -static id globalLogConfig = nil; - -@implementation GRPCCall (MobileLog) - -+ (void)setLogConfig:(id)logConfig { - globalLogConfig = logConfig; -} - -+ (id)logConfig { - return globalLogConfig; -} - -@end diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h index 6697f61be44..d9916d93036 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.h +++ b/src/objective-c/GRPCClient/private/GRPCHost.h @@ -37,6 +37,7 @@ struct grpc_channel_credentials; @property(nonatomic) grpc_compression_algorithm compressAlgorithm; @property(nonatomic) int keepaliveInterval; @property(nonatomic) int keepaliveTimeout; +@property(nonatomic) id logContext; /** The following properties should only be modified for testing: */ diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index c3ea9afc37b..bd5fd94118f 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -18,7 +18,6 @@ #import "GRPCHost.h" -#import #import #include #include @@ -223,9 +222,9 @@ static NSMutableDictionary *kHostCache; args[@GRPC_ARG_KEEPALIVE_TIMEOUT_MS] = [NSNumber numberWithInt:_keepaliveTimeout]; } - id logConfig = [GRPCCall logConfig]; - if (logConfig != nil) { - args[@GRPC_ARG_MOBILE_LOG_CONFIG] = logConfig; + id logContext = self.logContext; + if (logContext != nil) { + args[@GRPC_ARG_MOBILE_LOG_CONTEXT] = logContext; } if (useCronet) {