From 085c780c551670055eade00cb7fd5766e6470ddf Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 24 Jul 2007 16:07:38 +0000 Subject: TypeName is now pulled from the module itself --- modules.c | 12 ++++++++++++ modules.h | 1 + syslogd.c | 14 +++----------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/modules.c b/modules.c index 1565b31c..e1c1a271 100644 --- a/modules.c +++ b/modules.c @@ -69,6 +69,18 @@ static void moduleDestruct(modInfo_t *pThis) } +/* get the state-name of a module. The state name is its name + * together with a short description of the module state (which + * is pulled from the module itself. + * rgerhards, 2007-07-24 + * TODO: the actual state name is not yet pulled + */ +uchar *modGetStateName(modInfo_t *pThis) +{ + return(modGetName(pThis)); +} + + /* get the name of a module */ uchar *modGetName(modInfo_t *pThis) diff --git a/modules.h b/modules.h index 98e60c1a..a3479918 100644 --- a/modules.h +++ b/modules.h @@ -83,6 +83,7 @@ typedef struct moduleInfo { rsRetVal doModInit(rsRetVal (*modInit)(), uchar *name); modInfo_t *omodGetNxt(modInfo_t *pThis); uchar *modGetName(modInfo_t *pThis); +uchar *modGetStateName(modInfo_t *pThis); void modPrintList(void); #endif /* #ifndef MODULES_H_INCLUDED */ diff --git a/syslogd.c b/syslogd.c index a79e9424..02d859f2 100644 --- a/syslogd.c +++ b/syslogd.c @@ -466,13 +466,6 @@ union sockunion { #define LIST_DELIMITER ':' /* delimiter between two hosts */ -char *TypeNames[] = { - "UNUSED", "FILE", "TTY", "CONSOLE", - "FORW", "USERS", "WALL", "FORW(SUSPENDED)", - "FORW(UNKNOWN)", "PIPE", "MYSQL", "DISCARD", - "SHELL" -}; - struct filed *Files = NULL; /* read-only after init() (but beware of sigusr1!) */ struct filed consfile; /* initialized on startup, used during actions - maybe NON THREAD-SAFE */ struct filed emergfile; /* this is only used for emergency logging when @@ -3308,8 +3301,7 @@ rsRetVal fprintlog(register selector_t *f) f->f_pMsg = pMsg; /* use the new msg (pointer will be restored below) */ } - dprintf("Called fprintlog, logging to %s", TypeNames[f->f_type]); - /*dprintf("Called fprintlog, logging to %s", modGetName(pMod)); // TODO: this does not work with unused!*/ + dprintf("Called fprintlog, logging to %s", modGetStateName(f->pMod)); f->f_time = now; /* we need this for message repeation processing TODO: why must "now" be global? */ @@ -3380,7 +3372,7 @@ static void domark(void) for (f = Files; f != NULL ; f = f->f_next) { if (f->f_prevcount && now >= REPEATTIME(f)) { dprintf("flush %s: repeated %d times, %d sec.\n", - TypeNames[f->f_type], f->f_prevcount, + modGetStateName(f->pMod), f->f_prevcount, repeatinterval[f->f_repeatcount]); fprintlog(f); BACKOFF(f); @@ -4432,7 +4424,7 @@ static void init() rsCStrGetSzStr(f->f_filterData.prop.pCSCompValue)); printf("\tAction...: "); } - printf("%s: ", TypeNames[f->f_type]); + printf("%s: ", modGetStateName(f->pMod)); switch (f->f_type) { case F_FILE: case F_PIPE: -- cgit v1.2.3