Logging interface

This commit is contained in:
Marcus Weseloh 2020-11-10 23:58:44 +01:00
parent 66b7c19893
commit bae3dec78a

View file

@ -28,26 +28,30 @@ extern "C" {
/** /**
* @defgroup Logging Logging * @defgroup logging Logging
* @brief Logging interface
* *
* The default logging function of the fluidsynth prints its messages * Logging interface
* to the stderr. The synthesizer uses five level of messages: #FLUID_PANIC, *
* The default logging function of the fluidsynth prints its messages to the
* stderr. The synthesizer uses five level of messages: #FLUID_PANIC,
* #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG. * #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG.
* *
* A client application can install a new log function to handle the * A client application can install a new log function to handle the messages
* messages differently. In the following example, the application * differently. In the following example, the application sets a callback
* sets a callback function to display #FLUID_PANIC messages in a dialog, * function to display #FLUID_PANIC messages in a dialog, and ignores all other
* and ignores all other messages by setting the log function to * messages by setting the log function to NULL:
* NULL:
* *
* @code * @code
* fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window); * fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window);
* fluid_set_log_function(FLUID_ERR, NULL, NULL); * fluid_set_log_function(FLUID_ERR, NULL, NULL);
* fluid_set_log_function(FLUID_WARN, NULL, NULL); * fluid_set_log_function(FLUID_WARN, NULL, NULL);
* fluid_set_log_function(FLUID_DBG, NULL, NULL); * fluid_set_log_function(FLUID_DBG, NULL, NULL);
* @endcode * @endcode
* *
* @note The logging configuration is global and not tied to a specific
* synthesizer instance. That means that all synthesizer instances created in
* the same process share the same logging configuration.
*
* @{ * @{
*/ */
@ -61,13 +65,13 @@ enum fluid_log_level
FLUID_WARN, /**< Warning */ FLUID_WARN, /**< Warning */
FLUID_INFO, /**< Verbose informational messages */ FLUID_INFO, /**< Verbose informational messages */
FLUID_DBG, /**< Debugging messages */ FLUID_DBG, /**< Debugging messages */
#ifndef __DOXYGEN__ LAST_LOG_LEVEL /**< @internal This symbol is not part of the public API and ABI
LAST_LOG_LEVEL /**< @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ stability guarantee and may change at any time! */
#endif
}; };
/** /**
* Log function handler callback type used by fluid_set_log_function(). * Log function handler callback type used by fluid_set_log_function().
*
* @param level Log level (#fluid_log_level) * @param level Log level (#fluid_log_level)
* @param message Log message text * @param message Log message text
* @param data User data pointer supplied to fluid_set_log_function(). * @param data User data pointer supplied to fluid_set_log_function().
@ -84,7 +88,6 @@ FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3))) __attribute__ ((format (printf, 2, 3)))
#endif #endif
; ;
/* @} */ /* @} */
#ifdef __cplusplus #ifdef __cplusplus