diff --git a/server/include/hooks.h b/server/include/hooks.h index b245cc108..4436975d9 100644 --- a/server/include/hooks.h +++ b/server/include/hooks.h @@ -48,12 +48,6 @@ hook_cb_t hook_lookup(const char *name); /** Example hook: Print the message. */ int hook_print(struct msg *m, struct path *p); -/** Example hook: Log messages to a logfile in /tmp */ -int hook_log(struct msg *m, struct path *p); - -#define HOOK_LOG_MODE "w+" -#define HOOK_LOG_TEMPLATE "logs/s2ss-%Y_%m_%d-%H_%M_%S.log" - /** Example hook: Drop messages. */ int hook_decimate(struct msg *m, struct path *p); diff --git a/server/src/hooks.c b/server/src/hooks.c index 8502a960f..09691b598 100644 --- a/server/src/hooks.c +++ b/server/src/hooks.c @@ -24,7 +24,6 @@ /** @todo Make const */ static struct hook_id hook_list[] = { { hook_print, "print" }, - { hook_log, "log" }, { hook_decimate, "decimate" }, { hook_tofixed, "tofixed" }, { hook_ts, "ts" }, @@ -51,33 +50,6 @@ int hook_print(struct msg *m, struct path *p) return 0; } -int hook_log(struct msg *m, struct path *p) -{ - static pthread_key_t pkey; - FILE *file = pthread_getspecific(pkey); - - if (!file) { - char fstr[64], pstr[33]; - path_print(p, pstr, sizeof(pstr)); - - struct tm tm; - time_t ts = time(NULL); - localtime_r(&ts, &tm); - strftime(fstr, sizeof(fstr), HOOK_LOG_TEMPLATE, &tm); - - file = fopen(fstr, HOOK_LOG_MODE); - if (file) - debug(5, "Opened log file for path %s: %s", pstr, fstr); - - pthread_key_create(&pkey, (dtor_cb_t) fclose); - pthread_setspecific(pkey, file); - } - - msg_fprint(file, m); - - return 0; -} - int hook_decimate(struct msg *m, struct path *p) { /* Drop every HOOK_DECIMATE_RATIO'th message */