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

Unified Diff: webrtc/examples/objc/AppRTCDemo/common/ARDLogging.mm

Issue 1235563006: Move talk/examples/* to webrtc/examples. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 201507141427 Created 5 years, 5 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: webrtc/examples/objc/AppRTCDemo/common/ARDLogging.mm
diff --git a/webrtc/examples/objc/AppRTCDemo/common/ARDLogging.mm b/webrtc/examples/objc/AppRTCDemo/common/ARDLogging.mm
new file mode 100644
index 0000000000000000000000000000000000000000..3fd147c39a56988c03b2fae00fd68963739849c3
--- /dev/null
+++ b/webrtc/examples/objc/AppRTCDemo/common/ARDLogging.mm
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#import "ARDLogging.h"
+
+#include "webrtc/base/logging.h"
+
+void ARDLogInit() {
+#ifndef _DEBUG
+ // In debug builds the default level is LS_INFO and in non-debug builds it is
+ // disabled. Continue to log to console in non-debug builds, but only
+ // warnings and errors.
+ rtc::LogMessage::LogToDebug(rtc::LS_WARNING);
+#endif
+}
+
+void ARDLogToWebRTCLogger(ARDLogSeverity severity, NSString *logString) {
+ if (logString.length) {
+ const char* utf8String = logString.UTF8String;
+ switch (severity) {
+ case kARDLogSeverityVerbose:
+ LOG(LS_VERBOSE) << utf8String;
+ break;
+ case kARDLogSeverityInfo:
+ LOG(LS_INFO) << utf8String;
+ break;
+ case kARDLogSeverityWarning:
+ LOG(LS_WARNING) << utf8String;
+ break;
+ case kARDLogSeverityError:
+ LOG(LS_ERROR) << utf8String;
+ break;
+ }
+ }
+}
+
+NSString *ARDFileName(const char *filePath) {
+ NSString *nsFilePath =
+ [[NSString alloc] initWithBytesNoCopy:const_cast<char *>(filePath)
+ length:strlen(filePath)
+ encoding:NSUTF8StringEncoding
+ freeWhenDone:NO];
+ return nsFilePath.lastPathComponent;
+}

Powered by Google App Engine
This is Rietveld 408576698