Library logging

Library logging — Methods to redirect library logs to a user-defined output.

Functions

Types and Values

Description

This section defines the methods and types that allow the user to configure how the library logging is exposed.

Functions

ratp_log_level_str ()

const char *
ratp_log_level_str (ratp_log_level_t level);

Gets a description for the given ratp_log_level_t.

Parameters

level

a ratp_log_level_t.

[in]

Returns

a constant string.


ratp_log_handler_t ()

void
(*ratp_log_handler_t) (ratp_log_level_t level,
                       unsigned long  tid,
                       const char *message);

Logging handler.

Parameters

level

the ratp_log_level_t.

[in]

tid

thread ID where the log message was generated.

[in]

message

the log message.

[in]

ratp_log_set_level ()

void
ratp_log_set_level (ratp_log_level_t level);

Sets the logging level.

By default the logging level is RATP_LOG_LEVEL_ERROR.

Parameters

level

a ratp_log_level_t.

[in]

ratp_log_get_level ()

ratp_log_level_t
ratp_log_get_level (void);

Gets the current logging level configured.

Returns

a ratp_log_level_t.


ratp_log_set_handler ()

void
ratp_log_set_handler (ratp_log_handler_t handler);

Set logging handler.

This method would be usually called once before any other operation with the library, e.g. even before ratp_init().

Parameters

handler

a ratp_log_handler_t, or NULL.

[in][nullable]

Types and Values

enum ratp_log_level_t

Logging level.

Members

RATP_LOG_LEVEL_ERROR

Only error messages are reported.

 

RATP_LOG_LEVEL_WARNING

Warning and error messages are reported.

 

RATP_LOG_LEVEL_INFO

Info, warning and error messages are reported.

 

RATP_LOG_LEVEL_DEBUG

All messages, including debug ones, are reported.