| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #import "RTCLogging.h" | 11 #import "RTCLogging.h" |
| 12 | 12 |
| 13 #include "webrtc/base/logging.h" | 13 #include "webrtc/base/logging.h" |
| 14 | 14 |
| 15 rtc::LoggingSeverity RTCGetNativeLoggingSeverity(RTCLoggingSeverity severity) { | 15 rtc::LoggingSeverity RTCGetNativeLoggingSeverity(RTCLoggingSeverity severity) { |
| 16 switch (severity) { | 16 switch (severity) { |
| 17 case kRTCLoggingSeverityVerbose: | 17 case RTCLoggingSeverityVerbose: |
| 18 return rtc::LS_VERBOSE; | 18 return rtc::LS_VERBOSE; |
| 19 case kRTCLoggingSeverityInfo: | 19 case RTCLoggingSeverityInfo: |
| 20 return rtc::LS_INFO; | 20 return rtc::LS_INFO; |
| 21 case kRTCLoggingSeverityWarning: | 21 case RTCLoggingSeverityWarning: |
| 22 return rtc::LS_WARNING; | 22 return rtc::LS_WARNING; |
| 23 case kRTCLoggingSeverityError: | 23 case RTCLoggingSeverityError: |
| 24 return rtc::LS_ERROR; | 24 return rtc::LS_ERROR; |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string) { | 28 void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string) { |
| 29 if (log_string.length) { | 29 if (log_string.length) { |
| 30 const char* utf8_string = log_string.UTF8String; | 30 const char* utf8_string = log_string.UTF8String; |
| 31 LOG_V(RTCGetNativeLoggingSeverity(severity)) << utf8_string; | 31 LOG_V(RTCGetNativeLoggingSeverity(severity)) << utf8_string; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity) { | 35 void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity) { |
| 36 rtc::LogMessage::LogToDebug(RTCGetNativeLoggingSeverity(severity)); | 36 rtc::LogMessage::LogToDebug(RTCGetNativeLoggingSeverity(severity)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 NSString* RTCFileName(const char* file_path) { | 39 NSString* RTCFileName(const char* file_path) { |
| 40 NSString* ns_file_path = | 40 NSString* ns_file_path = |
| 41 [[NSString alloc] initWithBytesNoCopy:const_cast<char*>(file_path) | 41 [[NSString alloc] initWithBytesNoCopy:const_cast<char*>(file_path) |
| 42 length:strlen(file_path) | 42 length:strlen(file_path) |
| 43 encoding:NSUTF8StringEncoding | 43 encoding:NSUTF8StringEncoding |
| 44 freeWhenDone:NO]; | 44 freeWhenDone:NO]; |
| 45 return ns_file_path.lastPathComponent; | 45 return ns_file_path.lastPathComponent; |
| 46 } | 46 } |
| 47 | 47 |
| OLD | NEW |