TaPAS
0.2
|
Message displayer. More...
Go to the source code of this file.
Typedefs | |
typedef enum ccl_log_type_enum | ccl_log_type |
Enum that indicates which kind of message has to be displayed. Each kind of message can be displayed on a separate stream. | |
typedef void | ccl_log_proc (ccl_log_type type, const char *msg, void *data) |
Prototype of callback functions receiving messages. | |
Enumerations | |
enum | ccl_log_type_enum { CCL_LOG_DISPLAY = 0, CCL_LOG_WARNING, CCL_LOG_ERROR, CCL_LOG_DEBUG, CCL_LOG_PANIC, CCL_LOG_USR1, CCL_LOG_USR2 } |
Enum that indicates which kind of message has to be displayed. Each kind of message can be displayed on a separate stream. More... | |
Functions | |
void | ccl_log_add_listener (ccl_log_proc *proc, void *data) |
Adds a message listener. More... | |
void | ccl_log_remove_listener (ccl_log_proc *proc) |
Removes the listener proc. More... | |
int | ccl_log_has_listener (void) |
Checks if a listener of messages is yet positioned. More... | |
void | ccl_log_push_redirection (ccl_log_type type, ccl_log_proc *proc, void *data) |
Redirects the data sent to the stream type to the listener proc. More... | |
void | ccl_log_pop_redirection (ccl_log_type type) |
Removes redirection for the stream type. More... | |
void | ccl_log (ccl_log_type type, const char *fmt,...) |
Sends the message formatted using the specification fmt on the stream indicated by type. The formating string is written in the same way than the one used by ccl_string_format. More... | |
void | ccl_log_va (ccl_log_type type, const char *fmt, va_list pa) |
Behaves like ccl_log but the variable arguments are replaced by a va_list. More... | |
void | ccl_display (const char *fmt,...) |
Behaves like ccl_log but the message is send on CCL_LOG_DISPLAY. More... | |
void | ccl_warning (const char *fmt,...) |
Behaves like ccl_log but the message is send on CCL_LOG_WARNING. More... | |
void | ccl_panic (const char *fmt,...) |
Behaves like ccl_log but the message is send on CCL_LOG_PANIC. More... | |
void | ccl_error (const char *fmt,...) |
Behaves like ccl_log but the message is send on CCL_LOG_ERROR. More... | |
void | ccl_debug (const char *fmt,...) |
Behaves like ccl_log but the message is send on CCL_LOG_DEBUG. More... | |
void | ccl_debug_max_level (int maxlevel) |
Indicates maximal level after which nothing else is displayed. If the current level is >= maxlevel then messages sent to CCL_LOG_DEBUG are not displayed. If maxlevel < 0 then all messages are displayed. If maxlevel == 0 then no messages are displayed. More... | |
void | ccl_debug_push_tab_level (void) |
Increments the level of the CCL_LOG_DEBUG stream. | |
void | ccl_debug_pop_tab_level (void) |
Decrements the level of the CCL_LOG_DEBUG stream. | |
void | ccl_debug_start_timed_block (const char *fmt,...) |
Starts a timed block of statements. | |
void | ccl_debug_end_timed_block (void) |
Ends a timed block of statements. | |
void | ccl_log_redirect_to_string (ccl_log_type type, char **dst) |
Redirects messages sent to 'type' stream into the string 'dst'. More... | |
Variables | |
int | ccl_debug_is_on |
Boolean variable indicating if debugging traces are actived or not. | |
Message displayer.
Definition in file ccl-log.h.
enum ccl_log_type_enum |
Enum that indicates which kind of message has to be displayed. Each kind of message can be displayed on a separate stream.
void ccl_debug | ( | const char * | fmt, |
... | |||
) |
Behaves like ccl_log but the message is send on CCL_LOG_DEBUG.
This function maintains a counter that represents a level of information. The user can request the CCL_LOG_DEBUG stream to be restricted to message occuring only when the counter is less than a maximal value.
fmt | the formatting string |
void ccl_debug_max_level | ( | int | maxlevel | ) |
Indicates maximal level after which nothing else is displayed. If the current level is >= maxlevel then messages sent to CCL_LOG_DEBUG are not displayed. If maxlevel < 0 then all messages are displayed. If maxlevel == 0 then no messages are displayed.
maxlevel | the maximal level of information |
void ccl_display | ( | const char * | fmt, |
... | |||
) |
Behaves like ccl_log but the message is send on CCL_LOG_DISPLAY.
fmt | the formatting string |
void ccl_error | ( | const char * | fmt, |
... | |||
) |
Behaves like ccl_log but the message is send on CCL_LOG_ERROR.
fmt | the formatting string |
void ccl_log | ( | ccl_log_type | type, |
const char * | fmt, | ||
... | |||
) |
Sends the message formatted using the specification fmt on the stream indicated by type. The formating string is written in the same way than the one used by ccl_string_format.
type | the steam where message is sent |
fmt | the formatting string |
void ccl_log_add_listener | ( | ccl_log_proc * | proc, |
void * | data | ||
) |
Adds a message listener.
The function registers the function proc as a message listener. Thus, each time a new message M as to be send, the following statement is executed proc (type, M, data) where type is the ccl_log_type on which the message M is sent and data is the pointer given when registering the listener.
proc | the listener function |
data | a pointer to some data passed to proc each time it is called. |
int ccl_log_has_listener | ( | void | ) |
Checks if a listener of messages is yet positioned.
void ccl_log_pop_redirection | ( | ccl_log_type | type | ) |
Removes redirection for the stream type.
type | the redirected stream |
void ccl_log_push_redirection | ( | ccl_log_type | type, |
ccl_log_proc * | proc, | ||
void * | data | ||
) |
Redirects the data sent to the stream type to the listener proc.
Each time a message is sent on the stream type, instead of being treated by registered listeners, it is sent to proc.
type | the stream to redirect |
proc | the listener function |
data | a pointer to some data passed to proc each time it is called. |
void ccl_log_redirect_to_string | ( | ccl_log_type | type, |
char ** | dst | ||
) |
Redirects messages sent to 'type' stream into the string 'dst'.
type | the redirected stream |
dst | a pointer to the destination string |
void ccl_log_remove_listener | ( | ccl_log_proc * | proc | ) |
Removes the listener proc.
\proc | the listerner function |
void ccl_log_va | ( | ccl_log_type | type, |
const char * | fmt, | ||
va_list | pa | ||
) |
Behaves like ccl_log but the variable arguments are replaced by a va_list.
type | the steam where message is sent |
fmt | the formatting string |
pa | the list of arguments. |
void ccl_panic | ( | const char * | fmt, |
... | |||
) |
Behaves like ccl_log but the message is send on CCL_LOG_PANIC.
fmt | the formatting string |
void ccl_warning | ( | const char * | fmt, |
... | |||
) |
Behaves like ccl_log but the message is send on CCL_LOG_WARNING.
fmt | the formatting string |