Back to index

glibc  2.9
Functions | Variables
dbg_log.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include "dbg_log.h"
#include "nscd.h"

Go to the source code of this file.


void set_logfile (const char *logfile)
int init_logfile (void)
void dbg_log (const char *fmt,...)


static char * logfilename
int debug_level

Function Documentation

void dbg_log ( const char *  fmt,

Definition at line 53 of file dbg_log.c.

  va_list ap;
  char msg[512], msg2[512];

  va_start (ap, fmt);
  vsnprintf (msg2, sizeof (msg), fmt, ap);

  if (debug_level > 0)
      snprintf (msg, sizeof (msg), "%d: %s%s", getpid (), msg2,
              msg2[strlen (msg2) - 1] == '\n' ? "" : "\n");
      if (dbgout)
         fputs (msg, dbgout);
         fflush (dbgout);
       fputs (msg, stderr);
    syslog (LOG_NOTICE, "%d %s", getpid (), msg2);

  va_end (ap);

Here is the call graph for this function:

Here is the caller graph for this function:

int init_logfile ( void  )

Definition at line 42 of file dbg_log.c.

  if (logfilename)
      dbgout = fopen64 (logfilename, "a");
      return dbgout == NULL ? 0 : 1;
  return 1;

Here is the caller graph for this function:

void set_logfile ( const char *  logfile)

Definition at line 36 of file dbg_log.c.

  logfilename = strdup (logfile);

Here is the caller graph for this function:

Variable Documentation

Definition at line 32 of file dbg_log.c.

Definition at line 33 of file dbg_log.c.

char* logfilename [static]

Definition at line 31 of file dbg_log.c.