Aerospike Client exposed logging functionality including:
- Ability to control the verbosity of log messages.
- Direct where log messages are sent to.
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():
Where the my_log_callback
could be defined as
bool my_log_callback(
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.