Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: talk/examples/objc/AppRTCDemo/common/ARDLogging.h

Issue 1217473011: AppRTCDemo file logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: talk/examples/objc/AppRTCDemo/common/ARDLogging.h
diff --git a/talk/examples/objc/AppRTCDemo/ARDSDPUtils.h b/talk/examples/objc/AppRTCDemo/common/ARDLogging.h
similarity index 60%
copy from talk/examples/objc/AppRTCDemo/ARDSDPUtils.h
copy to talk/examples/objc/AppRTCDemo/common/ARDLogging.h
index 2f14e6dec0b40b77b1f6d03be0ef639387b4d0db..32955d57e8e45b7c01981ded98f39d4e1cd730a2 100644
--- a/talk/examples/objc/AppRTCDemo/ARDSDPUtils.h
+++ b/talk/examples/objc/AppRTCDemo/common/ARDLogging.h
@@ -27,15 +27,28 @@
#import <Foundation/Foundation.h>
-@class RTCSessionDescription;
+#if defined(__cplusplus)
+extern "C" void ARDLogToWebRTCLogger(NSString *logString);
+extern "C" NSString *ARDFileName(const char *filePath);
+#else
+extern void ARDLogToWebRTCLogger(NSString *logString);
+extern NSString *ARDFileName(const char *filePath);
+#endif
-@interface ARDSDPUtils : NSObject
+#define ARDLogString(format, ...) \
+ [NSString stringWithFormat:@"(%s %@:%d): " format, __PRETTY_FUNCTION__, ARDFileName(__FILE__), \
+ __LINE__, ##__VA_ARGS__]
-// Updates the original SDP description to instead prefer the specified video
-// codec. We do this by placing the specified codec at the beginning of the
-// codec list if it exists in the sdp.
-+ (RTCSessionDescription *)
- descriptionForDescription:(RTCSessionDescription *)description
- preferredVideoCodec:(NSString *)codec;
+#define ARDLog(format, ...) \
+ do { \
+ NSString *logString = ARDLogString(format, ##__VA_ARGS__); \
+ ARDLogToWebRTCLogger(logString); \
+ } while (false)
-@end
+#ifdef DEBUG
+#define ARDLogDebug(format, ...) ARDLog(format, ##__VA_ARGS__)
+#else
+#define ARDLogDebug(format, ...) \
+ do { \
+ } while (false)
+#endif

Powered by Google App Engine
This is Rietveld 408576698