1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

removed log hook, because it was replaced by the 'file' node type

This commit is contained in:
Steffen Vogel 2015-03-31 18:28:18 +02:00
parent cd76dc525a
commit d63c5e913b
2 changed files with 0 additions and 34 deletions

View file

@ -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);

View file

@ -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 */