blob: f4edb58847144afd821cf23d9927f8fc4c3f08c4 [file] [log] [blame]
Jiayang Liue63d2a12015-09-01 23:11:181/*
kjellanderb24317b2016-02-10 15:54:432 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
Jiayang Liue63d2a12015-09-01 23:11:183 *
kjellanderb24317b2016-02-10 15:54:434 * 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 23:11:189 */
10
11package org.webrtc;
12
13public class CallSessionFileRotatingLogSink {
Jiayang Liue63d2a12015-09-01 23:11:1814 private long nativeSink;
15
16 public static byte[] getLogData(String dirPath) {
Magnus Jedvert3ecec842018-06-07 10:57:0617 if (dirPath == null) {
18 throw new IllegalArgumentException("dirPath may not be null.");
19 }
Jiayang Liue63d2a12015-09-01 23:11:1820 return nativeGetLogData(dirPath);
21 }
22
23 public CallSessionFileRotatingLogSink(
24 String dirPath, int maxFileSize, Logging.Severity severity) {
Magnus Jedvert3ecec842018-06-07 10:57:0625 if (dirPath == null) {
26 throw new IllegalArgumentException("dirPath may not be null.");
27 }
Jiayang Liue63d2a12015-09-01 23:11:1828 nativeSink = nativeAddSink(dirPath, maxFileSize, severity.ordinal());
29 }
30
31 public void dispose() {
32 if (nativeSink != 0) {
33 nativeDeleteSink(nativeSink);
34 nativeSink = 0;
35 }
36 }
37
sakalb6760f92016-09-29 11:12:4438 private static native long nativeAddSink(String dirPath, int maxFileSize, int severity);
Magnus Jedvert84d8ae52017-12-20 14:12:1039 private static native void nativeDeleteSink(long sink);
Jiayang Liue63d2a12015-09-01 23:11:1840 private static native byte[] nativeGetLogData(String dirPath);
41}