Logging

## Logging Logging — Message and error logging. |

## Functions

int | (*librdf_log_level_func) ()
int | (*librdf_log_func) ()
int | librdf_log_message_code ()
librdf_log_level | librdf_log_message_level ()
librdf_log_facility | librdf_log_message_facility ()
const char * | librdf_log_message_message ()
raptor_locator * | librdf_log_message_locator ()

## Types and Values

enum | librdf_log_level
enum | librdf_log_facility

## 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.

## Functions

### 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.

#### Parameters

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.

#### Parameters

user_data | User data pointer |
message | Log message structure pointer. |

#### Returns

non-zero to indicate log message has been handled

### librdf_log_message_code ()

    int
    librdf_log_message_code (librdf_log_message *message);

Retrieve error code from log message.

#### Parameters

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

#### Parameters

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

message | log message |

#### Returns

pointer to an appropriate raptor_locator* or NULL if not available

## Types and Values

### enum librdf_log_level

Indicates the level of the log message.

#### Members

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

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

#### Members

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_RAPTOR | Raptor library (parser or serializer; Raptor 2.0.0+). |
LIBRDF_FROM_LAST | Internal, never returned. |