Brian Silverman | 890a32a | 2018-03-11 15:41:56 -0700 | [diff] [blame^] | 1 | package com.ctre.phoenix; |
| 2 | |
| 3 | public class Logger |
| 4 | { |
| 5 | /** |
| 6 | * Logs an entry into the Phoenix DS Error/Logger stream |
| 7 | * @param code Error code to log. If OKAY is passed, no action is taken. |
| 8 | * @param origin Origin string to send to DS/Log |
| 9 | * @return OKAY error code. |
| 10 | */ |
| 11 | public static ErrorCode log(ErrorCode code, String origin) { |
| 12 | /* only take action if the error code is nonzero */ |
| 13 | if (code != ErrorCode.OK) { |
| 14 | String stack = java.util.Arrays.toString(Thread.currentThread().getStackTrace()); |
| 15 | stack = stack.replaceAll(",", "\n"); |
| 16 | int errCode = code.value; |
| 17 | return ErrorCode.valueOf(CTRLoggerJNI.JNI_Logger_Log(errCode, origin, stack)); |
| 18 | } |
| 19 | /* otherwise return OK */ |
| 20 | return ErrorCode.OK; |
| 21 | } |
| 22 | |
| 23 | //public static void close() { |
| 24 | // //CTRLoggerJNI.JNI_Logger_Close(); |
| 25 | //} |
| 26 | //public static void open() { |
| 27 | // //CTRLoggerJNI.JNI_Logger_Open(2); |
| 28 | //} |
| 29 | /* |
| 30 | public static String getVerbose(int code) { |
| 31 | return CTRLoggerJNI.JNI_Logger_GetLong(code); |
| 32 | } |
| 33 | public static String getShort(int code) { |
| 34 | return CTRLoggerJNI.JNI_Logger_GetShort(code); |
| 35 | } |
| 36 | */ |
| 37 | } |
| 38 | |