|
dxFeed Graal Native SDK 3.13.0
|
The v4 functions and type names of the group Logging. Every function returns DXFG_EXECUTE_SUCCESSFULLY or DXFG_EXECUTE_FAIL and writes its result to a DXFG_OUT parameter, see The v4 functions. More...
Typedefs | |
| typedef dxfg_logging_level_t | dxfg_v4_logging_level_t |
| The logging levels that can be used to control the logging output. | |
| typedef dxfg_logging_listener_t | dxfg_v4_logging_listener_t |
| A handle of a Java InterceptableLoggingListener object, a wrapper of a listener that allows to intercept the logged messages; release it with dxfg_JavaObjectHandler_release(). | |
| typedef dxfg_logging_listener_function_t | dxfg_v4_logging_listener_function_t |
| The function of a dxfg_logging_listener_t: called for every message that is logged while the listener is installed and the level of the message is not below the logging level (see dxfg_logging_set_log_level()). | |
Functions | |
| int32_t | dxfg_v4_logging_listener_new (graal_isolatethread_t *thread, dxfg_v4_logging_listener_function_t user_func, void *user_data, DXFG_OUT dxfg_v4_logging_listener_t **listener) |
| Creates a new logging listener. | |
| int32_t | dxfg_v4_logging_set_listener (graal_isolatethread_t *thread, dxfg_v4_logging_listener_t *listener) |
| Installs the logging listener. | |
| int32_t | dxfg_v4_logging_set_log_level (graal_isolatethread_t *thread, dxfg_v4_logging_level_t level) |
| Sets the logging level for the listener or the console or the log file. | |
| int32_t | dxfg_v4_logging_set_err_level (graal_isolatethread_t *thread, dxfg_v4_logging_level_t level) |
| Sets the logging level for the err file. | |
The v4 functions and type names of the group Logging. Every function returns DXFG_EXECUTE_SUCCESSFULLY or DXFG_EXECUTE_FAIL and writes its result to a DXFG_OUT parameter, see The v4 functions.
The logging levels that can be used to control the logging output.
The values correspond to the levels of java.util.logging.Level that the logging system uses.
Java: java.util.logging.Level.
The function of a dxfg_logging_listener_t: called for every message that is logged while the listener is installed and the level of the message is not below the logging level (see dxfg_logging_set_log_level()).
The function is called synchronously by the Java thread that logs the message, which may be any thread of the isolate (including the threads of the endpoints), not the thread that installed the listener. The calls are serialized by a lock of the logging system: the function is never called concurrently, and while it runs the other threads that log wait. So it should return quickly and should not block.
The strings and the exception are allocated by the SDK for the call and released by the SDK after the function returns: copy what is needed, do not keep the pointers and do not release them. A string or the exception is NULL when the corresponding value is absent.
Java: InterceptableLoggingListener.onLog(Level, long, String, long, String, String, Throwable, String).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | level | The level of the message. |
| [in] | timestamp | The time of the message in milliseconds since the Unix epoch (UTC). |
| [in] | thread_name | The name of the Java thread that logged the message, a NUL-terminated UTF-8 string. |
| [in] | thread_id | The identifier of the Java thread that logged the message. |
| [in] | logger_name | The name of the logger, a NUL-terminated UTF-8 string (NULL if the logger has no name). |
| [in] | message | The text of the message without the time, the level and other parts of the layout, a NUL-terminated UTF-8 string. |
| [in] | exception | The exception that is logged with the message, or NULL if there is none. See dxfg_exception_t. |
| [in] | formatted_message | The whole line that the logging system would write: the message with the time, the level, the thread and the exception formatted with the layout of the logging system, a NUL-terminated UTF-8 string. |
| [in] | user_data | The pointer that was passed to dxfg_logging_listener_new(); the SDK does not use it. |
A handle of a Java InterceptableLoggingListener object, a wrapper of a listener that allows to intercept the logged messages; release it with dxfg_JavaObjectHandler_release().
Create it with dxfg_logging_listener_new() and install it with dxfg_logging_set_listener(). The last handle of the listener that is released deactivates the listener: its function is not called anymore.
| int32_t dxfg_v4_logging_listener_new | ( | graal_isolatethread_t * | thread, |
| dxfg_v4_logging_listener_function_t | user_func, | ||
| void * | user_data, | ||
| DXFG_OUT dxfg_v4_logging_listener_t ** | listener ) |
Creates a new logging listener.
The listener does nothing until it is installed with dxfg_v4_logging_set_listener(). The function is called as described at dxfg_v4_logging_listener_function_t.
Releasing the last handle of the listener with dxfg_v4_JavaObjectHandler_release() (or dxfg_v4_NativeListener_deactivate()) stops the calls of the function: after the release returns the function is not running and is not called anymore, so the user data can be freed. An installed listener cannot be replaced or removed (see dxfg_v4_logging_set_listener()), it can only be deactivated this way.
Java: InterceptableLoggingListener.onLog(Level, long, String, long, String, String, Throwable, String).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | user_func | The listener callback. |
| [in] | user_data | The user data that will be passed to the callback; the SDK does not use it. It must stay valid until the listener is deactivated. |
| [out] | listener | The pointer to the variable that receives the new listener (release its handle with dxfg_v4_JavaObjectHandler_release()). It is written only on success. A NULL pointer is an error. |
| int32_t dxfg_v4_logging_set_err_level | ( | graal_isolatethread_t * | thread, |
| dxfg_v4_logging_level_t | level ) |
Sets the logging level for the err file.
The level is set for the second handler of the logging system: the file of the errors (err.file). If there is no such handler (e.g. a listener is installed or err.file is not set), the function does nothing and returns DXFG_EXECUTE_SUCCESSFULLY. The default level of the err file is taken from the system property err.level (warnings and errors by default).
Java: InterceptableLogging.setErrLevel(Level).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | level | The new logging level. |
| int32_t dxfg_v4_logging_set_listener | ( | graal_isolatethread_t * | thread, |
| dxfg_v4_logging_listener_t * | listener ) |
Installs the logging listener.
It toggles the logging: the existing handlers of the logging system are removed, so the messages are not logged to the console and to files anymore, and the messages are given to the listener. The level of the messages that reach the listener is taken from the system property log.level (all messages by default) and can be changed with dxfg_v4_logging_set_log_level().
Only the first installed listener works: if a listener is already installed, the function does nothing. A NULL listener does nothing as well. In both cases the function returns DXFG_EXECUTE_SUCCESSFULLY. The installed listener cannot be removed; release its handle (see dxfg_v4_logging_listener_new()) to stop its calls.
Java: InterceptableLogging.setListener(InterceptableLoggingListener).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | listener | The logging listener. The caller keeps its handle. |
| int32_t dxfg_v4_logging_set_log_level | ( | graal_isolatethread_t * | thread, |
| dxfg_v4_logging_level_t | level ) |
Sets the logging level for the listener or the console or the log file.
The level is set for the first handler of the logging system: the handler of the listener if one is installed (see dxfg_v4_logging_set_listener()), otherwise the console or the log file (log.file). If there is no such handler, the function does nothing and returns DXFG_EXECUTE_SUCCESSFULLY.
Java: InterceptableLogging.setLogLevel(Level).
| [in] | thread | The current GraalVM Isolate's thread. |
| [in] | level | The new logging level. |