libcdio  2.1.0
Typedefs | Enumerations | Functions | Variables
logging.h File Reference

Header to control logging and level of detail of output. More...

#include <cdio/types.h>

Go to the source code of this file.

Typedefs

typedef void(* cdio_log_handler_t) (cdio_log_level_t level, const char message[])
 

Enumerations

enum  cdio_log_level_t {
  CDIO_LOG_DEBUG = 1, CDIO_LOG_INFO, CDIO_LOG_WARN, CDIO_LOG_ERROR,
  CDIO_LOG_ASSERT
}
 

Functions

void cdio_default_log_handler (cdio_log_level_t level, const char message[])
 
cdio_log_handler_t cdio_log_set_handler (cdio_log_handler_t new_handler)
 
void cdio_log (cdio_log_level_t level, const char format[],...) GNUC_PRINTF(2
 
void void cdio_debug (const char format[],...) GNUC_PRINTF(1
 
void void void cdio_info (const char format[],...) GNUC_PRINTF(1
 
void void void void cdio_warn (const char format[],...) GNUC_PRINTF(1
 
void void void void void cdio_error (const char format[],...) GNUC_PRINTF(1
 

Variables

cdio_log_level_t cdio_loglevel_default
 

Detailed Description

Header to control logging and level of detail of output.

Typedef Documentation

◆ cdio_log_handler_t

typedef void(* cdio_log_handler_t) (cdio_log_level_t level, const char message[])

This type defines the signature of a log handler. For every message being logged, the handler will receive the log level and the message string.

See also
cdio_log_set_handler
cdio_log_level_t
Parameters
levelThe log level.
messageThe log message.

Enumeration Type Documentation

◆ cdio_log_level_t

The different log levels supported.

Enumerator
CDIO_LOG_DEBUG 

Debug-level messages - helps debug what's up.

CDIO_LOG_INFO 

Informational - indicates perhaps something of interest.

CDIO_LOG_WARN 

Warning conditions - something that looks funny.

CDIO_LOG_ERROR 

Error conditions - may terminate program.

CDIO_LOG_ASSERT 

Critical conditions - may abort program.

Function Documentation

◆ cdio_debug()

void void cdio_debug ( const char  format[],
  ... 
)

Handle a debugging message.

See also
cdio_log for a more generic routine

◆ cdio_default_log_handler()

void cdio_default_log_handler ( cdio_log_level_t  level,
const char  message[] 
)

The initial or default log handler in effect.

Parameters
levelThe log level.
messageThe log message.

◆ cdio_error()

void void void void void cdio_error ( const char  format[],
  ... 
)

Handle an error message. Execution is terminated.

See also
cdio_log for a more generic routine.

◆ cdio_info()

void void void cdio_info ( const char  format[],
  ... 
)

Handle an informative message.

See also
cdio_log for a more generic routine

◆ cdio_log()

void cdio_log ( cdio_log_level_t  level,
const char  format[],
  ... 
)

Handle an message with the given log level.

See also
cdio_debug
cdio_info
cdio_warn
cdio_error
Parameters
levelThe log level.
formatprintf-style format string
...remaining arguments needed by format string

◆ cdio_log_set_handler()

cdio_log_handler_t cdio_log_set_handler ( cdio_log_handler_t  new_handler)

Set a custom log handler for libcdio. The return value is the log handler being replaced. If the provided parameter is NULL, then the handler will be reset to the default handler.

See also
cdio_log_handler_t
Parameters
new_handlerThe new log handler.
Returns
The previous log handler.

◆ cdio_warn()

void void void void cdio_warn ( const char  format[],
  ... 
)

Handle a warning message.

See also
cdio_log for a more generic routine

Variable Documentation

◆ cdio_loglevel_default

cdio_log_level_t cdio_loglevel_default

The place to save the preference concerning how much verbosity is desired. This is used by the internal default log handler, but it could be use by applications which provide their own log handler.