AppRTCDemo file logging.
Adds logging macros to log logs to a file. Undeletes CircularFileStream
for that purpose.
BUG=
R=jiayl@webrtc.org, pbos@webrtc.org
Review URL: https://codereview.webrtc.org/1217473011 .
Cr-Commit-Position: refs/heads/master@{#9582}
diff --git a/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m b/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m
index 27dd25d..f25e9d0 100644
--- a/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m
+++ b/talk/examples/objc/AppRTCDemo/ARDWebSocketChannel.m
@@ -27,6 +27,7 @@
#import "ARDWebSocketChannel.h"
+#import "ARDLogging.h"
#import "ARDUtilities.h"
#import "SRWebSocket.h"
@@ -57,7 +58,7 @@
_delegate = delegate;
_socket = [[SRWebSocket alloc] initWithURL:url];
_socket.delegate = self;
- NSLog(@"Opening WebSocket.");
+ ARDLog(@"Opening WebSocket.");
[_socket open];
}
return self;
@@ -104,12 +105,12 @@
NSString *messageString =
[[NSString alloc] initWithData:messageJSONObject
encoding:NSUTF8StringEncoding];
- NSLog(@"C->WSS: %@", messageString);
+ ARDLog(@"C->WSS: %@", messageString);
[_socket send:messageString];
} else {
NSString *dataString =
[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- NSLog(@"C->WSS POST: %@", dataString);
+ ARDLog(@"C->WSS POST: %@", dataString);
NSString *urlString =
[NSString stringWithFormat:@"%@/%@/%@",
[_restURL absoluteString], _roomId, _clientId];
@@ -126,7 +127,7 @@
return;
}
[_socket close];
- NSLog(@"C->WSS DELETE rid:%@ cid:%@", _roomId, _clientId);
+ ARDLog(@"C->WSS DELETE rid:%@ cid:%@", _roomId, _clientId);
NSString *urlString =
[NSString stringWithFormat:@"%@/%@/%@",
[_restURL absoluteString], _roomId, _clientId];
@@ -140,7 +141,7 @@
#pragma mark - SRWebSocketDelegate
- (void)webSocketDidOpen:(SRWebSocket *)webSocket {
- NSLog(@"WebSocket connection opened.");
+ ARDLog(@"WebSocket connection opened.");
self.state = kARDSignalingChannelStateOpen;
if (_roomId.length && _clientId.length) {
[self registerWithCollider];
@@ -154,24 +155,24 @@
options:0
error:nil];
if (![jsonObject isKindOfClass:[NSDictionary class]]) {
- NSLog(@"Unexpected message: %@", jsonObject);
+ ARDLog(@"Unexpected message: %@", jsonObject);
return;
}
NSDictionary *wssMessage = jsonObject;
NSString *errorString = wssMessage[kARDWSSMessageErrorKey];
if (errorString.length) {
- NSLog(@"WSS error: %@", errorString);
+ ARDLog(@"WSS error: %@", errorString);
return;
}
NSString *payload = wssMessage[kARDWSSMessagePayloadKey];
ARDSignalingMessage *signalingMessage =
[ARDSignalingMessage messageFromJSONString:payload];
- NSLog(@"WSS->C: %@", payload);
+ ARDLog(@"WSS->C: %@", payload);
[_delegate channel:self didReceiveMessage:signalingMessage];
}
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error {
- NSLog(@"WebSocket error: %@", error);
+ ARDLog(@"WebSocket error: %@", error);
self.state = kARDSignalingChannelStateError;
}
@@ -179,7 +180,7 @@
didCloseWithCode:(NSInteger)code
reason:(NSString *)reason
wasClean:(BOOL)wasClean {
- NSLog(@"WebSocket closed with code: %ld reason:%@ wasClean:%d",
+ ARDLog(@"WebSocket closed with code: %ld reason:%@ wasClean:%d",
(long)code, reason, wasClean);
NSParameterAssert(_state != kARDSignalingChannelStateError);
self.state = kARDSignalingChannelStateClosed;
@@ -204,7 +205,7 @@
error:nil];
NSString *messageString =
[[NSString alloc] initWithData:message encoding:NSUTF8StringEncoding];
- NSLog(@"Registering on WSS for rid:%@ cid:%@", _roomId, _clientId);
+ ARDLog(@"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];