| 1 | /* |
| 2 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; only |
| 7 | * version 2.1 of the License. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #include "org_lttng_ust_jul_LTTngUst.h" |
| 20 | |
| 21 | #define TRACEPOINT_DEFINE |
| 22 | #define TRACEPOINT_CREATE_PROBES |
| 23 | #include "lttng_ust_jul.h" |
| 24 | |
| 25 | JNIEXPORT void JNICALL Java_org_lttng_ust_jul_LTTngUst_tracepoint(JNIEnv *env, |
| 26 | jobject jobj, |
| 27 | jstring msg, |
| 28 | jstring logger_name, |
| 29 | jstring class_name, |
| 30 | jstring method_name, |
| 31 | jlong millis, |
| 32 | jint log_level, |
| 33 | jint thread_id) |
| 34 | { |
| 35 | jboolean iscopy; |
| 36 | const char *msg_cstr = (*env)->GetStringUTFChars(env, msg, &iscopy); |
| 37 | const char *logger_name_cstr = (*env)->GetStringUTFChars(env, logger_name, &iscopy); |
| 38 | const char *class_name_cstr = (*env)->GetStringUTFChars(env, class_name, &iscopy); |
| 39 | const char *method_name_cstr = (*env)->GetStringUTFChars(env, method_name, &iscopy); |
| 40 | |
| 41 | tracepoint(lttng_jul, jul_event, msg_cstr, logger_name_cstr, |
| 42 | class_name_cstr, method_name_cstr, millis, log_level, thread_id); |
| 43 | |
| 44 | (*env)->ReleaseStringUTFChars(env, msg, msg_cstr); |
| 45 | (*env)->ReleaseStringUTFChars(env, logger_name, logger_name_cstr); |
| 46 | (*env)->ReleaseStringUTFChars(env, class_name, class_name_cstr); |
| 47 | (*env)->ReleaseStringUTFChars(env, method_name, method_name_cstr); |
| 48 | } |