OLD | NEW |
(Empty) | |
| 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 |
| 11 #import "ARDLogging.h" |
| 12 |
| 13 #include "webrtc/base/logging.h" |
| 14 |
| 15 void ARDLogInit() { |
| 16 #ifndef _DEBUG |
| 17 // In debug builds the default level is LS_INFO and in non-debug builds it is |
| 18 // disabled. Continue to log to console in non-debug builds, but only |
| 19 // warnings and errors. |
| 20 rtc::LogMessage::LogToDebug(rtc::LS_WARNING); |
| 21 #endif |
| 22 } |
| 23 |
| 24 void ARDLogToWebRTCLogger(ARDLogSeverity severity, NSString *logString) { |
| 25 if (logString.length) { |
| 26 const char* utf8String = logString.UTF8String; |
| 27 switch (severity) { |
| 28 case kARDLogSeverityVerbose: |
| 29 LOG(LS_VERBOSE) << utf8String; |
| 30 break; |
| 31 case kARDLogSeverityInfo: |
| 32 LOG(LS_INFO) << utf8String; |
| 33 break; |
| 34 case kARDLogSeverityWarning: |
| 35 LOG(LS_WARNING) << utf8String; |
| 36 break; |
| 37 case kARDLogSeverityError: |
| 38 LOG(LS_ERROR) << utf8String; |
| 39 break; |
| 40 } |
| 41 } |
| 42 } |
| 43 |
| 44 NSString *ARDFileName(const char *filePath) { |
| 45 NSString *nsFilePath = |
| 46 [[NSString alloc] initWithBytesNoCopy:const_cast<char *>(filePath) |
| 47 length:strlen(filePath) |
| 48 encoding:NSUTF8StringEncoding |
| 49 freeWhenDone:NO]; |
| 50 return nsFilePath.lastPathComponent; |
| 51 } |
OLD | NEW |