1 /* FluidSynth - A Software Synthesizer
3 * Copyright (C) 2003 Peter Hanappe and others.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public License
7 * as published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
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 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library 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
21 #ifndef _FLUIDSYNTH_LOG_H
22 #define _FLUIDSYNTH_LOG_H
32 * @brief Logging interface
34 * The default logging function of the fluidsynth prints its messages
35 * to the stderr. The synthesizer uses five level of messages: #FLUID_PANIC,
36 * #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG.
38 * A client application can install a new log function to handle the
39 * messages differently. In the following example, the application
40 * sets a callback function to display #FLUID_PANIC messages in a dialog,
41 * and ignores all other messages by setting the log function to
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);
53 * FluidSynth log levels.
55 enum fluid_log_level {
56 FLUID_PANIC, /**< The synth can't function correctly any more */
57 FLUID_ERR, /**< Serious error occurred */
58 FLUID_WARN, /**< Warning */
59 FLUID_INFO, /**< Verbose informational messages */
60 FLUID_DBG, /**< Debugging messages */
65 * Log function handler callback type used by fluid_set_log_function().
66 * @param level Log level (#fluid_log_level)
67 * @param message Log message text
68 * @param data User data pointer supplied to fluid_set_log_function().
70 typedef void (*fluid_log_function_t)(int level, char* message, void* data);
73 fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void* data);
75 FLUIDSYNTH_API void fluid_default_log_function(int level, char* message, void* data);
77 FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...);
84 #endif /* _FLUIDSYNTH_LOG_H */