## Logging.

Logging. — Message and error logging.

## Synopsis

    int                 (*librdf_log_level_func)            (void *user_data,
                                                             const char *message,
                                                             va_list arguments);
    int                 (*librdf_log_func)                  (void *user_data,
                                                             librdf_log_message *message);
    enum                librdf_log_level;
    enum                librdf_log_facility;
    int                 librdf_log_message_code             (librdf_log_message *message);
    librdf_log_level    librdf_log_message_level            (librdf_log_message *message);
    librdf_log_facility librdf_log_message_facility         (librdf_log_message *message);
    const char*         librdf_log_message_message          (librdf_log_message *message);
    raptor_locator*     librdf_log_message_locator          (librdf_log_message *message);

## Description

Provides structured access to debug, information, warning and error messages from the libraries. Structured information is most often used from errors such as parsing where file or URI and line numbers can be returned via a raptor_locator object pointer found by `librdf_log_message_locator()` on the librdf_log_message.

## Details

### librdf_log_level_func ()

    int                 (*librdf_log_level_func)            (void *user_data,
                                                             const char *message,
                                                             va_list arguments);

Handler for one log level, for the warning and error levels ONLY. Used by librdf_world_set_warning and librdf_world_set_error.

`user_data` : | User data pointer
`message` : | Log message.
`arguments` : | Message arguments.
Returns : | non-zero to indicate log message has been handled

### librdf_log_func ()

    int                 (*librdf_log_func)                  (void *user_data,
                                                             librdf_log_message *message);

Handler for all log levels.

`user_data` : | User data pointer
`message` : | Log message structure pointer.
Returns : | non-zero to indicate log message has been handled

### enum librdf_log_level

    typedef enum {
      LIBRDF_LOG_NONE = 0,
      LIBRDF_LOG_DEBUG,
      LIBRDF_LOG_INFO,
      LIBRDF_LOG_WARN,
      LIBRDF_LOG_ERROR,
      LIBRDF_LOG_FATAL,
      LIBRDF_LOG_LAST=LIBRDF_LOG_FATAL
    } librdf_log_level;

Indicates the level of the log message.

`LIBRDF_LOG_NONE` | No level
`LIBRDF_LOG_DEBUG` | Debug.
`LIBRDF_LOG_INFO` | Information.
`LIBRDF_LOG_WARN` | Warning.
`LIBRDF_LOG_ERROR` | Recoverable error. Program can continue.
`LIBRDF_LOG_FATAL` | Fatal error. Program will abort if this is not caught.
`LIBRDF_LOG_LAST` | Internal, never returned.

### enum librdf_log_facility

    typedef enum {
      LIBRDF_FROM_NONE = 0,
      LIBRDF_FROM_CONCEPTS,
      LIBRDF_FROM_DIGEST,
      LIBRDF_FROM_FILES,
      LIBRDF_FROM_HASH,
      LIBRDF_FROM_INIT,
      LIBRDF_FROM_ITERATOR,
      LIBRDF_FROM_LIST,
      LIBRDF_FROM_MODEL,
      LIBRDF_FROM_NODE,
      LIBRDF_FROM_PARSER,
      LIBRDF_FROM_QUERY,
      LIBRDF_FROM_SERIALIZER,
      LIBRDF_FROM_STATEMENT,
      LIBRDF_FROM_STORAGE,
      LIBRDF_FROM_STREAM,
      LIBRDF_FROM_URI,
      LIBRDF_FROM_UTF8,
      LIBRDF_FROM_MEMORY,
      LIBRDF_FROM_LAST=LIBRDF_FROM_MEMORY
    } librdf_log_facility;

Indicates the part of the system that generated the log message.

`LIBRDF_FROM_NONE` | Associated with no part.
`LIBRDF_FROM_CONCEPTS` | Concepts
`LIBRDF_FROM_DIGEST` | Digest
`LIBRDF_FROM_FILES` | Files
`LIBRDF_FROM_HASH` | Hash
`LIBRDF_FROM_INIT` | Init
`LIBRDF_FROM_ITERATOR` | Iterator
`LIBRDF_FROM_LIST` | List
`LIBRDF_FROM_MODEL` | Model
`LIBRDF_FROM_NODE` | Node
`LIBRDF_FROM_PARSER` | Parser
`LIBRDF_FROM_QUERY` | Query
`LIBRDF_FROM_SERIALIZER` | Serializer
`LIBRDF_FROM_STATEMENT` | Statement
`LIBRDF_FROM_STORAGE` | Storage
`LIBRDF_FROM_STREAM` | Stream
`LIBRDF_FROM_URI` | URI
`LIBRDF_FROM_UTF8` | UTF8
`LIBRDF_FROM_MEMORY` | Memory
`LIBRDF_FROM_LAST` | Internal, never returned.

### librdf_log_message_code ()

    int                 librdf_log_message_code             (librdf_log_message *message);

Retrieve error code from log message.

`message` : | log message
Returns : | int error code

### librdf_log_message_level ()

    librdf_log_level    librdf_log_message_level            (librdf_log_message *message);

Retrieve severity of log message.

The log message severity level is defined in rdf_log.h as values of enum librdf_log_level

`message` : | log message
Returns : | severity level

### librdf_log_message_facility ()

    librdf_log_facility librdf_log_message_facility         (librdf_log_message *message);

Retrieve facility that generated the message.

The log message facility is defined in rdf_log.h as values of enum librdf_log_facility

`message` : | log message
Returns : | ID of Redland facility that generated the log message.

### librdf_log_message_message ()

    const char*         librdf_log_message_message          (librdf_log_message *message);

Retrieve text message from log entry.

The string returned is shared and must be copied by the caller if required to be retained.

`message` : | log message
Returns : | shared pointer to the log message string

### librdf_log_message_locator ()

    raptor_locator*     librdf_log_message_locator          (librdf_log_message *message);

Retrieve locator of log entry.

`message` : | log message
Returns : | pointer to an appropriate raptor_locator* or NULL if not available