| Index: talk/examples/objc/AppRTCDemo/common/ARDLogging.mm
|
| diff --git a/talk/app/webrtc/dtlsidentityservice.cc b/talk/examples/objc/AppRTCDemo/common/ARDLogging.mm
|
| similarity index 56%
|
| copy from talk/app/webrtc/dtlsidentityservice.cc
|
| copy to talk/examples/objc/AppRTCDemo/common/ARDLogging.mm
|
| index b4b7279c8288395a8e23a507f7c78dc199572cab..7bd773d770553fa65f855c98619c8d9eca3ad8ff 100644
|
| --- a/talk/app/webrtc/dtlsidentityservice.cc
|
| +++ b/talk/examples/objc/AppRTCDemo/common/ARDLogging.mm
|
| @@ -25,26 +25,44 @@
|
| * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#include "talk/app/webrtc/dtlsidentityservice.h"
|
| +#import "ARDLogging.h"
|
|
|
| -#include "talk/app/webrtc/dtlsidentitystore.h"
|
| #include "webrtc/base/logging.h"
|
|
|
| -namespace webrtc {
|
| +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
|
| +}
|
|
|
| -bool DtlsIdentityService::RequestIdentity(
|
| - const std::string& identity_name,
|
| - const std::string& common_name,
|
| - webrtc::DTLSIdentityRequestObserver* observer) {
|
| - if (identity_name != DtlsIdentityStore::kIdentityName ||
|
| - common_name != DtlsIdentityStore::kIdentityName) {
|
| - LOG(LS_WARNING) << "DtlsIdentityService::RequestIdentity called with "
|
| - << "unsupported params, identity_name=" << identity_name
|
| - << ", common_name=" << common_name;
|
| - return false;
|
| +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;
|
| + }
|
| }
|
| - store_->RequestIdentity(observer);
|
| - return true;
|
| }
|
|
|
| -} // namespace webrtc
|
| +NSString *ARDFileName(const char *filePath) {
|
| + NSString *nsFilePath =
|
| + [[NSString alloc] initWithBytesNoCopy:const_cast<char *>(filePath)
|
| + length:strlen(filePath)
|
| + encoding:NSUTF8StringEncoding
|
| + freeWhenDone:NO];
|
| + return nsFilePath.lastPathComponent;
|
| +}
|
|
|