log.h File Reference

Functions to log errors, warning and debug messages. More...

`#include <dc1394/dc1394.h>`

## Enumerations

enum | dc1394error_t
enum | dc1394log_t

## Functions

dc1394error_t | dc1394_log_register_handler (dc1394log_t type, void(*log_handler)(dc1394log_t type, const char *message, void *user), void *user)
dc1394error_t | dc1394_log_set_default_handler (dc1394log_t type)
void | dc1394_log_error (const char *format,...)
void | dc1394_log_warning (const char *format,...)
void | dc1394_log_debug (const char *format,...)

## Detailed Description

Functions to log errors, warning and debug messages.

Author
  Damien Douxchamps: coding
  Rudolf Leitgeb: coding
  Peter Antoniac: documentation maintainer

More details soon

## Enumeration Type Documentation

## dc1394error_t

enum dc1394error_t

Error codes returned by most libdc1394 functions.

General rule: 0 is success, negative denotes a problem.

## dc1394log_t

enum dc1394log_t

Types of logging messages

Three types exist:

- ERROR for real, hard, unrecoverable errors that will result in the program terminating.
- WARNING for things that have gone wrong, but are not requiring a termination of the program.
- DEBUG for debug messages that can be very verbose but may help the developers to fix bugs.

## Function Documentation

## dc1394_log_debug()

void dc1394_log_debug | ( | const char * | format,
|  |  | ...
| ) |  |

dc1394_log_debug: logs a debug statement to the registered facility This function shall be invoked if a debug statement is to be logged. The message passed as argument is delivered to the registered debug reporting function registered before ONLY IF the environment variable DC1394_DEBUG has been set before the program starts.

Parameters

  [in] | format,... | debug statement to be logged, multiple arguments allowed (printf style)

## dc1394_log_error()

void dc1394_log_error | ( | const char * | format,
|  |  | ...
| ) |  |

dc1394_log_error: logs a fatal error condition to the registered facility This function shall be invoked if a fatal error condition is encountered. The message passed as argument is delivered to the registered error reporting function registered before.

Parameters

  [in] | format,... | error message to be logged, multiple arguments allowed (printf style)

## dc1394_log_register_handler()

dc1394error_t dc1394_log_register_handler | ( | dc1394log_t | type,
|  | void(*)(dc1394log_t type, const char *message, void *user) | log_handler,
|  | void * | user
| ) |  |

dc1394_log_register_handler: register log handler for reporting error, warning or debug statements Passing NULL as argument turns off this log level.

Parameters

  [in] | log_handler | pointer to a function which takes a character string as argument type: the type of log
  [in] | type | message type (debug, err or warning)
  [in] | message | log message

## dc1394_log_set_default_handler()

dc1394error_t dc1394_log_set_default_handler | ( | dc1394log_t | type | ) |

dc1394_log_set_default_handler: set the log handler to the default handler At boot time, debug logging is OFF (handler is NULL). Using this function for the debug statements will start logging of debug statements usng the default handler.

## dc1394_log_warning()

void dc1394_log_warning | ( | const char * | format,
|  |  | ...
| ) |  |

dc1394_log_warning: logs a nonfatal error condition to the registered facility This function shall be invoked if a nonfatal error condition is encountered. The message passed as argument is delivered to the registered warning reporting function registered before.

Parameters

  [in] | format,... | warning message to be logged, multiple arguments allowed (printf style)