| 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. |
| 9 | */ |
| 10 |
| 11 | package org.webrtc; |
| 12 |
| 13 | public class CallSessionFileRotatingLogSink { |
| 14 | private long nativeSink; |
| 15 |
| 16 | public static byte[] getLogData(String dirPath) { |
| 17 | if (dirPath == null) { |
| 18 | throw new IllegalArgumentException("dirPath may not be null."); |
| 19 | } |
| 20 | return nativeGetLogData(dirPath); |
| 21 | } |
| 22 |
| 23 | public CallSessionFileRotatingLogSink( |
| 24 | String dirPath, int maxFileSize, Logging.Severity severity) { |
| 25 | if (dirPath == null) { |
| 26 | throw new IllegalArgumentException("dirPath may not be null."); |
| 27 | } |
| 28 | 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 |
| 38 | private static native long nativeAddSink(String dirPath, int maxFileSize, int severity); |
| 39 | private static native void nativeDeleteSink(long sink); |
| 40 | private static native byte[] nativeGetLogData(String dirPath); |
| 41 | } |
| 42 |