All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Fields | Related Functions
as_log Struct Reference

Detailed Description

Aerospike Client exposed logging functionality including:

Setting Log Level

To set the log level for the aerospike client, simply use as_log_set_level() and pass in the client log to set.

Redirecting Log Output

By default, the logger is not enabled.

To enable where log messages are sent, simply define a new as_log_callback, and set it for the client using as_log_set_callback():

as_log_set_callback(my_log_callback);

Where the my_log_callback could be defined as

bool my_log_callback(
as_log_level level, const char * func, const char * file, uint32_t line,
const char * fmt, ...)
{
char msg[1024] = {0};
va_list ap;
va_start(ap, fmt);
vsnprintf(msg, 1024, fmt, ap);
msg[1023] = '\0';
va_end(ap);
fprintf(stderr, "[%s:%d][%s] %d - %s\n", file, line, func, level, msg);
return true;
}

Definition at line 126 of file as_log.h.

#include "as_log.h"

+ Collaboration diagram for as_log:

Data Fields

as_log_callback callback
 
bool callback_set
 
as_log_level level
 

Related Functions

(Note that these are not member functions.)

static const char * as_log_level_tostring (as_log_level level)
 
static void as_log_set_callback (as_log_callback callback)
 
static void as_log_set_level (as_log_level level)
 

Friends And Related Function Documentation

static const char * as_log_level_tostring ( as_log_level  level)
related

Convert log level to a string.

Parameters
levelThe log level.

Definition at line 192 of file as_log.h.

static void as_log_set_callback ( as_log_callback  callback)
related

Set logging callback for the global client log. To silence the log, set callback to NULL.

Parameters
callbackThe log callback.

Definition at line 178 of file as_log.h.

static void as_log_set_level ( as_log_level  level)
related

Set logging level for the global client log.

Parameters
levelThe log level.

Definition at line 164 of file as_log.h.

Field Documentation

as_log_callback as_log::callback

Logging Callback

Definition at line 141 of file as_log.h.

bool as_log::callback_set

Was callback explicitly set.

Definition at line 136 of file as_log.h.

as_log_level as_log::level

Log Level

Definition at line 131 of file as_log.h.


The documentation for this struct was generated from the following file: