mondemandlib.h File Reference


Detailed Description

MonDemand client API file. This is the entry point for developers to gather stats and messages and log them to the configured transport.

Go to the source code of this file.

Functions

mondemand_client * mondemand_client_create (const char *program_identifier)
 Constructor used to create a new logging client.
void mondemand_client_destroy (struct mondemand_client *client)
 Destructor, used to clean up memory used by the client. This automatically flushes any unsent events.
void mondemand_set_immediate_send_level (struct mondemand_client *client, const int level)
 Method to set the immediate send level, which defines the minimum level where events are sent as soon as they are received (as opposed to being bundled). Out of range values are ignored.
void mondemand_set_no_send_level (struct mondemand_client *client, const int level)
 Method to set the no send level, which defines the minimum log level where events are sent at all. Anything lower than this defined level will be suppressed. Out of range values are ignored.
const char * mondemand_get_context (struct mondemand_client *client, const char *key)
 Returns the value for a given key.
const char ** mondemand_get_context_keys (struct mondemand_client *client)
 returns an array of keys. The array is NULL terminated, and must be freed by the caller when finished with it.
int mondemand_set_context (struct mondemand_client *client, const char *key, const char *value)
 Sets a contextual key/value pair to the client, which is sent out with event event. If a value is already set, it overwrites it. This method creates a copy of the key and value internally, so they can be freed once set.
void mondemand_remove_context (struct mondemand_client *client, const char *key)
 Removes a contextual key value pair from the client, and frees that memory.
void mondemand_remove_all_contexts (struct mondemand_client *client)
 Method to remove all contextual key/value pairs. Frees all related memory. client a mondemand_client object pointer.
int mondemand_log_real (struct mondemand_client *client, const char *filename, const int line, const int level, const struct mondemand_trace_id trace_id, const char *format,...)
 full-featured logging function, usually called by macros.
int mondemand_log_real_va (struct mondemand_client *client, const char *filename, const int line, const int level, const struct mondemand_trace_id trace_id, const char *format, va_list args)
 full-featured logging function, usually called by macros. This function takes a va_list so that calling functions can pass ellipsis style arguments
int mondemand_stats_inc (struct mondemand_client *client, const char *filename, const int line, const char *key, const int value)
 lower-level stats function that increments a named key with the given value
int mondemand_stats_dec (struct mondemand_client *client, const char *filename, const int line, const char *key, const int value)
 lower-level stats function that decrements a named key with the given value
int mondemand_stats_set (struct mondemand_client *client, const char *filename, const int line, const char *key, const int value)
 lower-level stats function that sets a named key with the given value


Function Documentation

struct mondemand_client* mondemand_client_create ( const char *  program_identifier  ) 

Constructor used to create a new logging client.

Parameters:
program_identifier a string identifying this program to the network
Returns:
a mondemand_client object pointer

void mondemand_client_destroy ( struct mondemand_client *  client  ) 

Destructor, used to clean up memory used by the client. This automatically flushes any unsent events.

Parameters:
client mondemand_client object to be deleted.

void mondemand_set_immediate_send_level ( struct mondemand_client *  client,
const int  level 
)

Method to set the immediate send level, which defines the minimum level where events are sent as soon as they are received (as opposed to being bundled). Out of range values are ignored.

Parameters:
client a mondemand_client object pointer
level a log level

void mondemand_set_no_send_level ( struct mondemand_client *  client,
const int  level 
)

Method to set the no send level, which defines the minimum log level where events are sent at all. Anything lower than this defined level will be suppressed. Out of range values are ignored.

Parameters:
client a mondemand_client object pointer
level a log level

int mondemand_set_context ( struct mondemand_client *  client,
const char *  key,
const char *  value 
)

Sets a contextual key/value pair to the client, which is sent out with event event. If a value is already set, it overwrites it. This method creates a copy of the key and value internally, so they can be freed once set.

Returns:
zero on success, non-zero on failure


Generated on Tue May 12 14:40:00 2009 for mondemand by  doxygen 1.4.7