aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
authorGravatar Muxi Yan <muxi@users.noreply.github.com>2018-06-07 10:34:14 -0700
committerGravatar GitHub <noreply@github.com>2018-06-07 10:34:14 -0700
commita323b51ece13ee8b28788b7d03cada6daeb215cd (patch)
tree3562a43f26431f4bdadc6a105eb5c8f9855c2c69 /src/objective-c
parent125596dfc99c5f30da4cb17de0745477f1c32b02 (diff)
parent4dbd18aec54f2818187f51d6ffef59ad72aef9a9 (diff)
Merge pull request #15567 from muxi/mobile-log-per-host
Make mobile log per-host
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+MobileLog.h30
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+MobileLog.m33
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.h1
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.m7
4 files changed, 4 insertions, 67 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall+MobileLog.h b/src/objective-c/GRPCClient/GRPCCall+MobileLog.h
deleted file mode 100644
index 53b347d9ca..0000000000
--- 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 4dedb7de8b..0000000000
--- 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 6697f61be4..d9916d9303 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 c3ea9afc37..bd5fd94118 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 <GRPCClient/GRPCCall+MobileLog.h>
#import <GRPCClient/GRPCCall.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
@@ -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) {