OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "webrtc/rtc_base/logging.h" | 13 #include "webrtc/rtc_base/logging.h" |
14 #include "webrtc/sdk/android/src/jni/jni_helpers.h" | 14 #include "webrtc/sdk/android/src/jni/jni_helpers.h" |
15 #include "webrtc/system_wrappers/include/logcat_trace_context.h" | 15 #include "webrtc/system_wrappers/include/logcat_trace_context.h" |
16 #include "webrtc/system_wrappers/include/trace.h" | 16 #include "webrtc/system_wrappers/include/trace.h" |
17 | 17 |
18 namespace webrtc_jni { | 18 namespace webrtc { |
| 19 namespace jni { |
19 | 20 |
20 JNI_FUNCTION_DECLARATION(void, | 21 JNI_FUNCTION_DECLARATION(void, |
21 Logging_nativeEnableTracing, | 22 Logging_nativeEnableTracing, |
22 JNIEnv* jni, | 23 JNIEnv* jni, |
23 jclass, | 24 jclass, |
24 jstring j_path, | 25 jstring j_path, |
25 jint nativeLevels) { | 26 jint nativeLevels) { |
26 std::string path = JavaToStdString(jni, j_path); | 27 std::string path = JavaToStdString(jni, j_path); |
27 if (nativeLevels != webrtc::kTraceNone) { | 28 if (nativeLevels != kTraceNone) { |
28 webrtc::Trace::set_level_filter(nativeLevels); | 29 Trace::set_level_filter(nativeLevels); |
29 if (path != "logcat:") { | 30 if (path != "logcat:") { |
30 RTC_CHECK_EQ(0, webrtc::Trace::SetTraceFile(path.c_str(), false)) | 31 RTC_CHECK_EQ(0, Trace::SetTraceFile(path.c_str(), false)) |
31 << "SetTraceFile failed"; | 32 << "SetTraceFile failed"; |
32 } else { | 33 } else { |
33 // Intentionally leak this to avoid needing to reason about its lifecycle. | 34 // Intentionally leak this to avoid needing to reason about its lifecycle. |
34 // It keeps no state and functions only as a dispatch point. | 35 // It keeps no state and functions only as a dispatch point. |
35 static webrtc::LogcatTraceContext* g_trace_callback = | 36 static LogcatTraceContext* g_trace_callback = new LogcatTraceContext(); |
36 new webrtc::LogcatTraceContext(); | |
37 } | 37 } |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 JNI_FUNCTION_DECLARATION(void, | 41 JNI_FUNCTION_DECLARATION(void, |
42 Logging_nativeEnableLogToDebugOutput, | 42 Logging_nativeEnableLogToDebugOutput, |
43 JNIEnv* jni, | 43 JNIEnv* jni, |
44 jclass, | 44 jclass, |
45 jint nativeSeverity) { | 45 jint nativeSeverity) { |
46 if (nativeSeverity >= rtc::LS_SENSITIVE && nativeSeverity <= rtc::LS_NONE) { | 46 if (nativeSeverity >= rtc::LS_SENSITIVE && nativeSeverity <= rtc::LS_NONE) { |
(...skipping 21 matching lines...) Expand all Loading... |
68 JNIEnv* jni, | 68 JNIEnv* jni, |
69 jclass, | 69 jclass, |
70 jint j_severity, | 70 jint j_severity, |
71 jstring j_tag, | 71 jstring j_tag, |
72 jstring j_message) { | 72 jstring j_message) { |
73 std::string message = JavaToStdString(jni, j_message); | 73 std::string message = JavaToStdString(jni, j_message); |
74 std::string tag = JavaToStdString(jni, j_tag); | 74 std::string tag = JavaToStdString(jni, j_tag); |
75 LOG_TAG(static_cast<rtc::LoggingSeverity>(j_severity), tag) << message; | 75 LOG_TAG(static_cast<rtc::LoggingSeverity>(j_severity), tag) << message; |
76 } | 76 } |
77 | 77 |
78 } // namespace webrtc_jni | 78 } // namespace jni |
| 79 } // namespace webrtc |
OLD | NEW |