libfluidsynth  1.1.11
Typedefs | Enumerations | Functions
log.h File Reference

Logging interface. More...

Typedefs

typedef void(* fluid_log_function_t) (int level, char *message, void *data)
 Log function handler callback type used by fluid_set_log_function(). More...
 

Enumerations

enum  fluid_log_level {
  FLUID_PANIC, FLUID_ERR, FLUID_WARN, FLUID_INFO,
  FLUID_DBG, LAST_LOG_LEVEL
}
 FluidSynth log levels. More...
 

Functions

FLUIDSYNTH_API fluid_log_function_t fluid_set_log_function (int level, fluid_log_function_t fun, void *data)
 Installs a new log function for a specified log level. More...
 
FLUIDSYNTH_API void fluid_default_log_function (int level, char *message, void *data)
 Default log function which prints to the stderr. More...
 
FLUIDSYNTH_API int fluid_log (int level, const char *fmt,...)
 Print a message to the log. More...
 

Detailed Description

Logging interface.

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.

A client application can install a new log function to handle the messages differently. In the following example, the application sets a callback function to display FLUID_PANIC messages in a dialog, and ignores all other messages by setting the log function to NULL:

Typedef Documentation

◆ fluid_log_function_t

typedef void(* fluid_log_function_t) (int level, char *message, void *data)

Log function handler callback type used by fluid_set_log_function().

Parameters
levelLog level (fluid_log_level)
messageLog message text
dataUser data pointer supplied to fluid_set_log_function().

Enumeration Type Documentation

◆ fluid_log_level

FluidSynth log levels.

Enumerator
FLUID_PANIC 

The synth can't function correctly any more.

FLUID_ERR 

Serious error occurred.

FLUID_WARN 

Warning.

FLUID_INFO 

Verbose informational messages.

FLUID_DBG 

Debugging messages.

LAST_LOG_LEVEL 
Deprecated:
As of 1.1.7 this enum value is deprecated and will be removed in a future release, because it prevents adding new enum values without breaking ABI compatibility.

Function Documentation

◆ fluid_set_log_function()

FLUIDSYNTH_API fluid_log_function_t fluid_set_log_function ( int  level,
fluid_log_function_t  fun,
void *  data 
)

Installs a new log function for a specified log level.

Parameters
levelLog level to install handler for.
funCallback function handler to call for logged messages
dataUser supplied data pointer to pass to log function
Returns
The previously installed function.

References LAST_LOG_LEVEL.

Referenced by fluid_default_log_function().

◆ fluid_default_log_function()

FLUIDSYNTH_API void fluid_default_log_function ( int  level,
char *  message,
void *  data 
)

Default log function which prints to the stderr.

Parameters
levelLog level
messageLog message
dataUser supplied data (not used)

References FLUID_DBG, FLUID_ERR, FLUID_INFO, FLUID_PANIC, fluid_set_log_function(), and FLUID_WARN.

◆ fluid_log()

FLUIDSYNTH_API int fluid_log ( int  level,
const char *  fmt,
  ... 
)

Print a message to the log.

Parameters
levelLog level (fluid_log_level).
fmtPrintf style format string for log message
...Arguments for printf 'fmt' message string
Returns
Always returns FLUID_FAILED

References FLUID_ERR, FLUID_FAILED, and LAST_LOG_LEVEL.

Referenced by fluid_event_get_sfont_id(), fluid_sequencer_get_time_scale(), fluid_sequencer_register_client(), fluid_sequencer_register_fluidsynth(), fluid_sequencer_set_time_scale(), new_fluid_event(), and new_fluid_sequencer2().