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 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.
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 * Library General Public License for more details.
14 *
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 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 * 02111-1307, USA
19 */
20
21#ifndef _FLUIDSYNTH_LOG_H
22#define _FLUIDSYNTH_LOG_H
23
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29
30/**
31 * @file log.h
32 * @brief Logging interface
33 *
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.
37 *
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
42 * NULL:
43 *
44 * DOCME (formatting)
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 */
50
51/**
52 * FluidSynth log levels.
53 */
54enum fluid_log_level {
55  FLUID_PANIC,   /**< The synth can't function correctly any more */
56  FLUID_ERR,     /**< Serious error occurred */
57  FLUID_WARN,    /**< Warning */
58  FLUID_INFO,    /**< Verbose informational messages */
59  FLUID_DBG,     /**< Debugging messages */
60  LAST_LOG_LEVEL
61};
62
63/**
64 * Log function handler callback type used by fluid_set_log_function().
65 * @param level Log level (#fluid_log_level)
66 * @param message Log message text
67 * @param data User data pointer supplied to fluid_set_log_function().
68 */
69typedef void (*fluid_log_function_t)(int level, char* message, void* data);
70
71FLUIDSYNTH_API
72fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void* data);
73
74FLUIDSYNTH_API void fluid_default_log_function(int level, char* message, void* data);
75
76FLUIDSYNTH_API int fluid_log(int level, char * fmt, ...);
77
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif /* _FLUIDSYNTH_LOG_H */
84