Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1217)

Unified Diff: talk/app/webrtc/java/src/org/webrtc/Logging.java

Issue 1335103004: Log to the webrtc log stream from webrtc/modules java code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | talk/libjingle.gyp » ('j') | talk/libjingle.gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/src/org/webrtc/Logging.java
diff --git a/talk/app/webrtc/java/src/org/webrtc/Logging.java b/talk/app/webrtc/java/src/org/webrtc/Logging.java
deleted file mode 100644
index c2ab274ddfcc8c8e593c0ea0dc576c2b7a489bae..0000000000000000000000000000000000000000
--- a/talk/app/webrtc/java/src/org/webrtc/Logging.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * libjingle
- * Copyright 2013 Google Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.webrtc;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.charset.Charset;
-import java.util.EnumSet;
-
-/** Java wrapper for WebRTC & libjingle logging. */
-public class Logging {
- static {
- System.loadLibrary("jingle_peerconnection_so");
- }
-
- // Keep in sync with webrtc/common_types.h:TraceLevel.
- public enum TraceLevel {
- TRACE_NONE(0x0000),
- TRACE_STATEINFO(0x0001),
- TRACE_WARNING(0x0002),
- TRACE_ERROR(0x0004),
- TRACE_CRITICAL(0x0008),
- TRACE_APICALL(0x0010),
- TRACE_DEFAULT(0x00ff),
- TRACE_MODULECALL(0x0020),
- TRACE_MEMORY(0x0100),
- TRACE_TIMER(0x0200),
- TRACE_STREAM(0x0400),
- TRACE_DEBUG(0x0800),
- TRACE_INFO(0x1000),
- TRACE_TERSEINFO(0x2000),
- TRACE_ALL(0xffff);
-
- public final int level;
- TraceLevel(int level) {
- this.level = level;
- }
- };
-
- // Keep in sync with webrtc/base/logging.h:LoggingSeverity.
- public enum Severity {
- LS_SENSITIVE, LS_VERBOSE, LS_INFO, LS_WARNING, LS_ERROR,
- };
-
- public static void enableLogThreads() {
- nativeEnableLogThreads();
- }
-
- public static void enableLogTimeStamps() {
- nativeEnableLogTimeStamps();
- }
-
- // Enable tracing to |path| of messages of |levels| and |severity|.
- // On Android, use "logcat:" for |path| to send output there.
- public static void enableTracing(
- String path, EnumSet<TraceLevel> levels, Severity severity) {
- int nativeLevel = 0;
- for (TraceLevel level : levels) {
- nativeLevel |= level.level;
- }
- nativeEnableTracing(path, nativeLevel, severity.ordinal());
- }
-
- public static void log(Severity severity, String tag, String message) {
- nativeLog(severity.ordinal(), tag, message);
- }
-
- public static void d(String tag, String message) {
- log(Severity.LS_INFO, tag, message);
- }
-
- public static void e(String tag, String message) {
- log(Severity.LS_ERROR, tag, message);
- }
-
- public static void w(String tag, String message) {
- log(Severity.LS_WARNING, tag, message);
- }
-
- public static void e(String tag, String message, Throwable e) {
- log(Severity.LS_ERROR, tag, message);
- log(Severity.LS_ERROR, tag, e.toString());
- log(Severity.LS_ERROR, tag, getStackTraceString(e));
- }
-
- public static void w(String tag, String message, Throwable e) {
- log(Severity.LS_WARNING, tag, message);
- log(Severity.LS_WARNING, tag, e.toString());
- log(Severity.LS_WARNING, tag, getStackTraceString(e));
- }
-
- public static void v(String tag, String message) {
- log(Severity.LS_VERBOSE, tag, message);
- }
-
- private static String getStackTraceString(Throwable e) {
- if (e == null) {
- return "";
- }
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- e.printStackTrace(pw);
- return sw.toString();
- }
-
- private static native void nativeEnableTracing(
- String path, int nativeLevels, int nativeSeverity);
- private static native void nativeEnableLogThreads();
- private static native void nativeEnableLogTimeStamps();
- private static native void nativeLog(int severity, String tag, String message);
-}
« no previous file with comments | « no previous file | talk/libjingle.gyp » ('j') | talk/libjingle.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698