You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright 2015 The WebRTC project authors. All Rights Reserved.
  3. *
  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
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import "RTCLogging.h"
  11. #include "rtc_base/logging.h"
  12. rtc::LoggingSeverity RTCGetNativeLoggingSeverity(RTCLoggingSeverity severity) {
  13. switch (severity) {
  14. case RTCLoggingSeverityVerbose:
  15. return rtc::LS_VERBOSE;
  16. case RTCLoggingSeverityInfo:
  17. return rtc::LS_INFO;
  18. case RTCLoggingSeverityWarning:
  19. return rtc::LS_WARNING;
  20. case RTCLoggingSeverityError:
  21. return rtc::LS_ERROR;
  22. case RTCLoggingSeverityNone:
  23. return rtc::LS_NONE;
  24. }
  25. }
  26. void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string) {
  27. if (log_string.length) {
  28. const char* utf8_string = log_string.UTF8String;
  29. RTC_LOG_V(RTCGetNativeLoggingSeverity(severity)) << utf8_string;
  30. }
  31. }
  32. void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity) {
  33. rtc::LogMessage::LogToDebug(RTCGetNativeLoggingSeverity(severity));
  34. }
  35. NSString* RTCFileName(const char* file_path) {
  36. NSString* ns_file_path =
  37. [[NSString alloc] initWithBytesNoCopy:const_cast<char*>(file_path)
  38. length:strlen(file_path)
  39. encoding:NSUTF8StringEncoding
  40. freeWhenDone:NO];
  41. return ns_file_path.lastPathComponent;
  42. }