blob: 9b53ce4873946093f0d510ba7be76384e1e8d48d [file] [log] [blame]
Jiayang Liue63d2a12015-09-01 16:11:18 -07001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
Jiayang Liue63d2a12015-09-01 16:11:18 -07003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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.
Jiayang Liue63d2a12015-09-01 16:11:18 -07009 */
10
11package org.webrtc;
12
13public class CallSessionFileRotatingLogSink {
14 static {
15 System.loadLibrary("jingle_peerconnection_so");
16 }
17
18 private long nativeSink;
19
20 public static byte[] getLogData(String dirPath) {
21 return nativeGetLogData(dirPath);
22 }
23
24 public CallSessionFileRotatingLogSink(
25 String dirPath, int maxFileSize, Logging.Severity severity) {
26 nativeSink = nativeAddSink(dirPath, maxFileSize, severity.ordinal());
27 }
28
29 public void dispose() {
30 if (nativeSink != 0) {
31 nativeDeleteSink(nativeSink);
32 nativeSink = 0;
33 }
34 }
35
sakalb6760f92016-09-29 04:12:44 -070036 private static native long nativeAddSink(String dirPath, int maxFileSize, int severity);
Jiayang Liue63d2a12015-09-01 16:11:18 -070037 private static native void nativeDeleteSink(long nativeSink);
38 private static native byte[] nativeGetLogData(String dirPath);
39}