Injectable logging

Allows passing a Loggable to PCFactory.initializationOptions, which
is then injected to Logging.java and logging.h. Future log messages
in both Java and native will then be passed to this Loggable.

Bug: webrtc:9225
Change-Id: I2ff693380639448301a78a93dc11d3a0106f0967
Reviewed-on: https://webrtc-review.googlesource.com/73243
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23241}
This commit is contained in:
Paulina Hensman
2018-05-15 13:41:06 +02:00
committed by Commit Bot
parent 8694f29b30
commit 59216ec4a4
16 changed files with 390 additions and 70 deletions

View File

@ -0,0 +1,28 @@
/*
* Copyright 2018 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
import org.webrtc.CalledByNative;
import org.webrtc.Loggable;
import org.webrtc.Logging.Severity;
class JNILogging {
private final Loggable loggable;
public JNILogging(Loggable loggable) {
this.loggable = loggable;
}
@CalledByNative
public void logToInjectable(String message, Integer severity, String tag) {
loggable.onLogMessage(message, Severity.values()[severity], tag);
}
}