5 #include <memcached/extension.h>
6 #include <memcached/extension_loggers.h>
7 #include <memcached/engine.h>
9 static EXTENSION_LOG_LEVEL current_log_level = EXTENSION_LOG_WARNING;
12 static const char *stderror_get_name(
void) {
13 return "standard error";
16 static void stderror_logger_log(EXTENSION_LOG_LEVEL severity,
17 const void* client_cookie,
20 if (severity >= current_log_level) {
22 int len = strlen(fmt);
23 bool needlf = (len > 0 && fmt[len - 1] !=
'\n');
26 vfprintf(stderr, fmt, ap);
29 fprintf(stderr,
"\n");
37 .log = stderror_logger_log
40 static void on_log_level(
const void *cookie,
41 ENGINE_EVENT_TYPE
type,
42 const void *event_data,
43 const void *cb_data) {
45 current_log_level = sapi->log->get_level();
50 sapi = get_server_api();
55 current_log_level = sapi->log->get_level();
62 static const char *null_get_name(
void) {
66 static void null_logger_log(EXTENSION_LOG_LEVEL severity,
67 const void* client_cookie,
78 .log = null_logger_log
82 return &null_logger_descriptor;
86 return &stderror_logger_descriptor;