inc/log.h File Reference

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

Go to the source code of this file.

Functions

void logOpenSyslog (char *program, char *facility)
void logOpenFile (char *program, char *logFile)
FILE * logGetFile ()
void logErrorVa (char *format, va_list args)
void logError (char *format,...)
void logWarnVa (char *format, va_list args)
void logWarn (char *format,...)
void logInfoVa (char *format, va_list args)
void logInfo (char *format,...)
void logDebugVa (char *format, va_list args)
void logDebug (char *format,...)
void logDaemonize (char *progName)


Function Documentation

void logDaemonize ( char *  progName  ) 

Definition at line 244 of file log.c.

References logOpenFile(), logOpenSyslog(), mustFork(), optionExists(), and optionVal().

00248 {
00249 if (!optionExists("debug"))
00250     {
00251     int i, maxFiles = getdtablesize();
00252     if (mustFork() != 0)
00253         exit(0);  /* parent goes away */
00254 
00255     /* Close all open files first (before logging) */
00256     for (i = 0; i < maxFiles; i++)
00257         close(i);
00258     }
00259 
00260 /* Set up log handler. */
00261 if (optionExists("log"))
00262     logOpenFile(progName, optionVal("log", NULL));
00263 else    
00264     logOpenSyslog(progName, optionVal("logFacility", NULL));
00265 }

Here is the call graph for this function:

void logDebug ( char *  format,
  ... 
)

Definition at line 235 of file log.c.

References logDebugVa().

Referenced by dnaQuery(), pcrQuery(), startServer(), transQuery(), and transTransQuery().

00237 {
00238 va_list args;
00239 va_start(args, format);
00240 logDebugVa(format, args);
00241 va_end(args);
00242 }

Here is the call graph for this function:

Here is the caller graph for this function:

void logDebugVa ( char *  format,
va_list  args 
)

Definition at line 224 of file log.c.

References gLogFh, gSysLogOn, and logFilePrint().

Referenced by logDebug().

00226 {
00227 #ifndef NO_SYSLOG
00228 if (gSysLogOn)
00229     vsyslog(LOG_DEBUG, format, args);
00230 #endif
00231 if (gLogFh != NULL)
00232     logFilePrint("debug", format, args);
00233 }

Here is the call graph for this function:

Here is the caller graph for this function:

void logError ( char *  format,
  ... 
)

Definition at line 175 of file log.c.

References logErrorVa().

Referenced by errorSafeCleanupMess(), logAbortHandler(), and startServer().

00177 {
00178 va_list args;
00179 va_start(args, format);
00180 logErrorVa(format, args);
00181 va_end(args);
00182 }

Here is the call graph for this function:

Here is the caller graph for this function:

void logErrorVa ( char *  format,
va_list  args 
)

Definition at line 164 of file log.c.

References gLogFh, gSysLogOn, and logFilePrint().

Referenced by logError(), and logWarnHander().

00166 {
00167 #ifndef NO_SYSLOG
00168 if (gSysLogOn)
00169     vsyslog(LOG_ERR, format, args);
00170 #endif
00171 if (gLogFh != NULL)
00172     logFilePrint("error", format, args);
00173 }

Here is the call graph for this function:

Here is the caller graph for this function:

FILE* logGetFile (  ) 

Definition at line 143 of file log.c.

References gLogFh.

Referenced by startServer().

00147 {
00148 return gLogFh;
00149 }

Here is the caller graph for this function:

void logInfo ( char *  format,
  ... 
)

Definition at line 215 of file log.c.

References logInfoVa().

Referenced by startServer().

00217 {
00218 va_list args;
00219 va_start(args, format);
00220 logInfoVa(format, args);
00221 va_end(args);
00222 }

Here is the call graph for this function:

Here is the caller graph for this function:

void logInfoVa ( char *  format,
va_list  args 
)

Definition at line 204 of file log.c.

References gLogFh, gSysLogOn, and logFilePrint().

Referenced by logInfo().

00206 {
00207 #ifndef NO_SYSLOG
00208 if (gSysLogOn)
00209     vsyslog(LOG_INFO, format, args);
00210 #endif
00211 if (gLogFh != NULL)
00212     logFilePrint("info", format, args);
00213 }

Here is the call graph for this function:

Here is the caller graph for this function:

void logOpenFile ( char *  program,
char *  logFile 
)

Definition at line 131 of file log.c.

References gLogFh, logAbortHandler(), logWarnHander(), mustOpen(), pushAbortHandler(), pushWarnHandler(), and setProgram().

Referenced by logDaemonize(), and main().

00136 {
00137 setProgram(program);
00138 gLogFh = mustOpen(logFile, "a");
00139 pushWarnHandler(logWarnHander);
00140 pushAbortHandler(logAbortHandler);
00141 }

Here is the call graph for this function:

Here is the caller graph for this function:

void logOpenSyslog ( char *  program,
char *  facility 
)

Definition at line 113 of file log.c.

References errAbort(), gSysLogOn, logAbortHandler(), logWarnHander(), parseFacility(), pushAbortHandler(), pushWarnHandler(), setProgram(), and TRUE.

Referenced by logDaemonize(), and main().

00119 {
00120 #ifndef NO_SYSLOG
00121 setProgram(program);
00122 openlog(program, LOG_PID, parseFacility(facility));
00123 pushWarnHandler(logWarnHander);
00124 pushAbortHandler(logAbortHandler);
00125 gSysLogOn = TRUE;
00126 #else
00127 errAbort("syslog support was not compiled into %s", __FILE__);
00128 #endif
00129 }

Here is the call graph for this function:

Here is the caller graph for this function:

void logWarn ( char *  format,
  ... 
)

Definition at line 195 of file log.c.

References logWarnVa().

00197 {
00198 va_list args;
00199 va_start(args, format);
00200 logWarnVa(format, args);
00201 va_end(args);
00202 }

Here is the call graph for this function:

void logWarnVa ( char *  format,
va_list  args 
)

Definition at line 184 of file log.c.

References gLogFh, gSysLogOn, and logFilePrint().

Referenced by logWarn().

00186 {
00187 #ifndef NO_SYSLOG
00188 if (gSysLogOn)
00189     vsyslog(LOG_WARNING, format, args);
00190 #endif
00191 if (gLogFh != NULL)
00192     logFilePrint("warn", format, args);
00193 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 19:04:25 2007 for blat by  doxygen 1.5.2