summaryrefslogtreecommitdiff
path: root/logger.h
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2015-11-25 15:43:01 -0800
committerdormando <dormando@rydia.net>2016-06-16 17:14:34 -0700
commit73407543d9b6b80828251ecabb2efd4b4ddc4c95 (patch)
tree9feb69c14f2992aaacbe2f1799a2272380288383 /logger.h
parent916fff3609b7ab817513a1a8498795c9f740d0e0 (diff)
downloadmemcached-73407543d9b6b80828251ecabb2efd4b4ddc4c95.tar.gz
manage logger watcher flags.
very temporary user control. allows to watch either fetchers or evictions, but not both, and always with timestamps.
Diffstat (limited to 'logger.h')
-rw-r--r--logger.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/logger.h b/logger.h
index 3756f0f..c4279ac 100644
--- a/logger.h
+++ b/logger.h
@@ -48,15 +48,7 @@ typedef struct _logentry {
} data[];
} logentry;
-typedef struct _logger {
- struct _logger *prev;
- struct _logger *next;
- pthread_mutex_t mutex; /* guard for this + *buf */
- uint64_t logged; /* entries written to the buffer */
- uint64_t dropped; /* entries dropped */
- uint64_t blocked; /* times blocked instead of dropped */
- uint16_t fetcher_ratio; /* log one out of every N fetches */
- uint16_t mutation_ratio; /* log one out of every N mutations */
+struct logger_eflags {
unsigned int log_sysevents :1; /* threads start/stop/working */
unsigned int log_fetchers :1; /* get/gets/etc */
unsigned int log_mutations :1; /* set/append/incr/etc */
@@ -66,6 +58,18 @@ typedef struct _logger {
unsigned int log_evictions :1; /* log details of evicted items */
unsigned int log_strict :1; /* block instead of drop */
unsigned int log_time :1; /* log the time the entry is created */
+};
+
+typedef struct _logger {
+ struct _logger *prev;
+ struct _logger *next;
+ pthread_mutex_t mutex; /* guard for this + *buf */
+ uint64_t logged; /* entries written to the buffer */
+ uint64_t dropped; /* entries dropped */
+ uint64_t blocked; /* times blocked instead of dropped */
+ uint16_t fetcher_ratio; /* log one out of every N fetches */
+ uint16_t mutation_ratio; /* log one out of every N mutations */
+ struct logger_eflags f; /* flags this logger should log */
bipbuf_t *buf;
const entry_details *entry_map;
} logger;
@@ -92,6 +96,7 @@ typedef struct {
int flushed; /* backlog data flushed so far from active chunk */
int id; /* id number for watcher list */
enum logger_watcher_type t; /* stderr, client, syslog, etc */
+ struct logger_eflags f; /* flags we are interested in */
} logger_watcher;
extern pthread_key_t logger_key;
@@ -109,6 +114,6 @@ enum logger_add_watcher_ret {
LOGGER_ADD_WATCHER_FAILED
};
-enum logger_add_watcher_ret logger_add_watcher(void *c, int sfd);
+enum logger_add_watcher_ret logger_add_watcher(void *c, const int sfd, const struct logger_eflags);
#endif