log.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int writeLog (const char *format,...)
int inform (const char *fmt,...)
char * sysLogPriId (int i)
int sysLogPri (char *name)
char * sysLogFacId (int i)
int sysLogFac (char *name)


Function Documentation

int inform const char *  fmt,
  ...
 

int sysLogFac char *  name  ) 
 

sysLogFac returns an integer representing the syslog facility given or -1 if name is unknown.

Definition at line 109 of file log.c.

Referenced by main(), and readConfig().

00109                           {
00110      int i;
00111      for(i = 0; facilitynames[i].c_name != NULL; i++) 
00112           if(strcmp(name,facilitynames[i].c_name) == 0)
00113                return facilitynames[i].c_val;
00114      return -1;
00115 }

char* sysLogFacId int  fac  ) 
 

sysLogFac returns a pointer to a string representing the given log facility or NULL if fac is unknown.

Definition at line 98 of file log.c.

Referenced by dumpConfig(), and usage().

00098                             {
00099      int i;
00100      for(i = 0; facilitynames[i].c_name != NULL; i++) 
00101           if(facilitynames[i].c_val == fac)
00102                return facilitynames[i].c_name;
00103      return NULL;
00104 }

int sysLogPri char *  name  ) 
 

sysLogPri returns an integer representing the syslog priority given or -1 if name is unknown.

Definition at line 87 of file log.c.

Referenced by main(), and readConfig().

00087                           {
00088      int i;
00089      for(i = 0; prioritynames[i].c_name != NULL; i++) 
00090           if(strcmp(name,prioritynames[i].c_name) == 0)
00091                return prioritynames[i].c_val;
00092      return -1;
00093 }

char* sysLogPriId int  pri  ) 
 

sysLogPri returns a pointer to a string representing the given log priority or NULL if pri is unknown.

Definition at line 76 of file log.c.

Referenced by dumpConfig(), and usage().

00076                             {
00077      int i;
00078      for(i = 0; prioritynames[i].c_name != NULL; i++) 
00079           if(prioritynames[i].c_val == pri)
00080                return prioritynames[i].c_name;
00081      return NULL;
00082 }

int writeLog const char *  fmt,
  ...
 

write, printf-style, a message to the system log

Definition at line 26 of file log.c.

References confVarSyslog().

Referenced by compactIpList(), inform(), ipadd(), loadIpList(), and secwatch().

00026                                    {
00027      va_list ap;
00028      static int fac=-1, pri, e;
00029      if(fac == -1) {
00030           fac = confVarSyslog("logfac",&e);
00031           pri = confVarSyslog("logpri",&e);
00032      }
00033      openlog("secwatch",LOG_PID,fac);
00034      va_start(ap,fmt);
00035      vsyslog(pri,fmt,ap);
00036      va_end(ap);
00037      return 1;
00038 }

Here is the call graph for this function:


Generated on Tue Oct 31 10:17:33 2006 for secwatch by  doxygen 1.4.6