iOS: Move AppRTC logging methods to public headers.
BUG=
Review URL: https://codereview.webrtc.org/1241283004
Cr-Commit-Position: refs/heads/master@{#9629}
diff --git a/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m b/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m
index f25e9d0..a089ff8 100644
--- a/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m
+++ b/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m
@@ -27,10 +27,11 @@
#import "ARDWebSocketChannel.h"
-#import "ARDLogging.h"
-#import "ARDUtilities.h"
+#import "RTCLogging.h"
#import "SRWebSocket.h"
+#import "ARDUtilities.h"
+
// TODO(tkchin): move these to a configuration object.
static NSString const *kARDWSSMessageErrorKey = @"error";
static NSString const *kARDWSSMessagePayloadKey = @"msg";
@@ -58,7 +59,7 @@
_delegate = delegate;
_socket = [[SRWebSocket alloc] initWithURL:url];
_socket.delegate = self;
- ARDLog(@"Opening WebSocket.");
+ RTCLog(@"Opening WebSocket.");
[_socket open];
}
return self;
@@ -105,12 +106,12 @@
NSString *messageString =
[[NSString alloc] initWithData:messageJSONObject
encoding:NSUTF8StringEncoding];
- ARDLog(@"C->WSS: %@", messageString);
+ RTCLog(@"C->WSS: %@", messageString);
[_socket send:messageString];
} else {
NSString *dataString =
[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- ARDLog(@"C->WSS POST: %@", dataString);
+ RTCLog(@"C->WSS POST: %@", dataString);
NSString *urlString =
[NSString stringWithFormat:@"%@/%@/%@",
[_restURL absoluteString], _roomId, _clientId];
@@ -127,7 +128,7 @@
return;
}
[_socket close];
- ARDLog(@"C->WSS DELETE rid:%@ cid:%@", _roomId, _clientId);
+ RTCLog(@"C->WSS DELETE rid:%@ cid:%@", _roomId, _clientId);
NSString *urlString =
[NSString stringWithFormat:@"%@/%@/%@",
[_restURL absoluteString], _roomId, _clientId];
@@ -141,7 +142,7 @@
#pragma mark - SRWebSocketDelegate
- (void)webSocketDidOpen:(SRWebSocket *)webSocket {
- ARDLog(@"WebSocket connection opened.");
+ RTCLog(@"WebSocket connection opened.");
self.state = kARDSignalingChannelStateOpen;
if (_roomId.length && _clientId.length) {
[self registerWithCollider];
@@ -155,24 +156,24 @@
options:0
error:nil];
if (![jsonObject isKindOfClass:[NSDictionary class]]) {
- ARDLog(@"Unexpected message: %@", jsonObject);
+ RTCLogError(@"Unexpected message: %@", jsonObject);
return;
}
NSDictionary *wssMessage = jsonObject;
NSString *errorString = wssMessage[kARDWSSMessageErrorKey];
if (errorString.length) {
- ARDLog(@"WSS error: %@", errorString);
+ RTCLogError(@"WSS error: %@", errorString);
return;
}
NSString *payload = wssMessage[kARDWSSMessagePayloadKey];
ARDSignalingMessage *signalingMessage =
[ARDSignalingMessage messageFromJSONString:payload];
- ARDLog(@"WSS->C: %@", payload);
+ RTCLog(@"WSS->C: %@", payload);
[_delegate channel:self didReceiveMessage:signalingMessage];
}
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error {
- ARDLog(@"WebSocket error: %@", error);
+ RTCLogError(@"WebSocket error: %@", error);
self.state = kARDSignalingChannelStateError;
}
@@ -180,7 +181,7 @@
didCloseWithCode:(NSInteger)code
reason:(NSString *)reason
wasClean:(BOOL)wasClean {
- ARDLog(@"WebSocket closed with code: %ld reason:%@ wasClean:%d",
+ RTCLog(@"WebSocket closed with code: %ld reason:%@ wasClean:%d",
(long)code, reason, wasClean);
NSParameterAssert(_state != kARDSignalingChannelStateError);
self.state = kARDSignalingChannelStateClosed;
@@ -205,7 +206,7 @@
error:nil];
NSString *messageString =
[[NSString alloc] initWithData:message encoding:NSUTF8StringEncoding];
- ARDLog(@"Registering on WSS for rid:%@ cid:%@", _roomId, _clientId);
+ RTCLog(@"Registering on WSS for rid:%@ cid:%@", _roomId, _clientId);
// Registration can fail if server rejects it. For example, if the room is
// full.
[_socket send:messageString];