Jiayang Liu | e63d2a1 | 2015-09-01 16:11:18 -0700 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
Jiayang Liu | e63d2a1 | 2015-09-01 16:11:18 -0700 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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 |
| 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 Liu | e63d2a1 | 2015-09-01 16:11:18 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | package org.webrtc; |
| 12 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 13 | @JNINamespace("webrtc::jni") |
Jiayang Liu | e63d2a1 | 2015-09-01 16:11:18 -0700 | [diff] [blame] | 14 | public class CallSessionFileRotatingLogSink { |
Jiayang Liu | e63d2a1 | 2015-09-01 16:11:18 -0700 | [diff] [blame] | 15 | private long nativeSink; |
| 16 | |
| 17 | public static byte[] getLogData(String dirPath) { |
| 18 | return nativeGetLogData(dirPath); |
| 19 | } |
| 20 | |
| 21 | public CallSessionFileRotatingLogSink( |
| 22 | String dirPath, int maxFileSize, Logging.Severity severity) { |
| 23 | nativeSink = nativeAddSink(dirPath, maxFileSize, severity.ordinal()); |
| 24 | } |
| 25 | |
| 26 | public void dispose() { |
| 27 | if (nativeSink != 0) { |
| 28 | nativeDeleteSink(nativeSink); |
| 29 | nativeSink = 0; |
| 30 | } |
| 31 | } |
| 32 | |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 33 | private static native long nativeAddSink(String dirPath, int maxFileSize, int severity); |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame] | 34 | private static native void nativeDeleteSink(long sink); |
Jiayang Liu | e63d2a1 | 2015-09-01 16:11:18 -0700 | [diff] [blame] | 35 | private static native byte[] nativeGetLogData(String dirPath); |
| 36 | } |