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:

Each aerospike contains its own as_log instance: aerospike.log.

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 sends log messages to STDERR.

To change 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(&as->log, 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 134 of file as_log.h.

#include "as_log.h"

+ Collaboration diagram for as_log:

Data Fields

cf_atomic_p callback
 
cf_atomic32 level
 

Related Functions

(Note that these are not member functions.)

as_logas_log_init (as_log *log)
 
bool as_log_set_callback (as_log *log, as_log_callback callback)
 
bool as_log_set_level (as_log *log, as_log_level level)
 

Friends And Related Function Documentation

as_log * as_log_init ( as_log log)
related

Initialize Log Context

bool as_log_set_callback ( as_log log,
as_log_callback  callback 
)
related

Set the callback for the given log

Parameters
logThe log context.
callbackThe log callback.
Returns
true on success. Otherwise false.
bool as_log_set_level ( as_log log,
as_log_level  level 
)
related

Set the level for the given log.

Parameters
logThe log context.
levelThe log level.
Returns
true on success. Otherwise false.

Field Documentation

cf_atomic_p as_log::callback

Logging Callback

Definition at line 144 of file as_log.h.

cf_atomic32 as_log::level

Log Level

Definition at line 139 of file as_log.h.


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