diff options
author | dormando <dormando@rydia.net> | 2016-06-16 00:00:47 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2016-06-16 17:14:35 -0700 |
commit | cb8257e342d4d691e146333f7684ebc754f9d36b (patch) | |
tree | 3bc39aa1192ba9597621ac59856b249016bc6d42 /logger.h | |
parent | f27a1022cf6832d070bd10a7c7bdc579ec9371e3 (diff) | |
download | memcached-cb8257e342d4d691e146333f7684ebc754f9d36b.tar.gz |
convert eviction log to new process
add LOGGER_LOG() macro wrapper for callers.
eviction logging is now using the "more final" method, where data is copied
into structs embedded into the per-worker circular buffer. This moves the
expensive snprintf calls to the background thread, and also allows making the
logging format switchable.
also switched the format to key=value. it's still largely readable but much
easier to parse.
Diffstat (limited to 'logger.h')
-rw-r--r-- | logger.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -39,6 +39,14 @@ typedef const struct { char *format; } entry_details; +struct logentry_eviction { + long long int exptime; + uint32_t latime; + uint16_t it_flags; + uint8_t nkey; + char key[]; +}; + typedef struct _logentry { enum log_entry_subtype event; uint16_t eflags; @@ -105,6 +113,15 @@ extern pthread_key_t logger_key; void logger_init(void); logger *logger_create(void); +#define LOGGER_LOG(l, flag, type, ...) \ + do { \ + logger *myl = l; \ + if (l == NULL) \ + myl = GET_LOGGER(); \ + if (myl->eflags & flag) \ + logger_log(myl, type, __VA_ARGS__); \ + } while (0) + enum logger_ret_type logger_log(logger *l, const enum log_entry_type event, const void *entry, ...); enum logger_add_watcher_ret { |