1 /* FluidSynth - A Software Synthesizer 2 * 3 * Copyright (C) 2003 Peter Hanappe and others. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public License 7 * as published by the Free Software Foundation; either version 2.1 of 8 * the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free 17 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 * 02110-1301, USA 19 */ 20 21 #ifndef _FLUIDSYNTH_LOG_H 22 #define _FLUIDSYNTH_LOG_H 23 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 30 /** 31 * @defgroup logging Logging 32 * 33 * Logging interface 34 * 35 * The default logging function of the fluidsynth prints its messages to the 36 * stderr. The synthesizer uses five level of messages: #FLUID_PANIC, 37 * #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG. 38 * 39 * A client application can install a new log function to handle the messages 40 * differently. In the following example, the application sets a callback 41 * function to display #FLUID_PANIC messages in a dialog, and ignores all other 42 * messages by setting the log function to NULL: 43 * 44 * @code 45 * fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window); 46 * fluid_set_log_function(FLUID_ERR, NULL, NULL); 47 * fluid_set_log_function(FLUID_WARN, NULL, NULL); 48 * fluid_set_log_function(FLUID_DBG, NULL, NULL); 49 * @endcode 50 * 51 * @note The logging configuration is global and not tied to a specific 52 * synthesizer instance. That means that all synthesizer instances created in 53 * the same process share the same logging configuration. 54 * 55 * @{ 56 */ 57 58 /** 59 * FluidSynth log levels. 60 */ 61 enum fluid_log_level 62 { 63 FLUID_PANIC, /**< The synth can't function correctly any more */ 64 FLUID_ERR, /**< Serious error occurred */ 65 FLUID_WARN, /**< Warning */ 66 FLUID_INFO, /**< Verbose informational messages */ 67 FLUID_DBG, /**< Debugging messages */ 68 LAST_LOG_LEVEL /**< @internal This symbol is not part of the public API and ABI 69 stability guarantee and may change at any time! */ 70 }; 71 72 /** 73 * Log function handler callback type used by fluid_set_log_function(). 74 * 75 * @param level Log level (#fluid_log_level) 76 * @param message Log message text 77 * @param data User data pointer supplied to fluid_set_log_function(). 78 */ 79 typedef void (*fluid_log_function_t)(int level, const char *message, void *data); 80 81 FLUIDSYNTH_API 82 fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void *data); 83 84 FLUIDSYNTH_API void fluid_default_log_function(int level, const char *message, void *data); 85 86 FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...) 87 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) 88 __attribute__ ((format (printf, 2, 3))) 89 #endif 90 ; 91 /* @} */ 92 93 #ifdef __cplusplus 94 } 95 #endif 96 97 #endif /* _FLUIDSYNTH_LOG_H */ 98