42 static FILE *log = NULL;
50 if ((!filename) || (!strcmp (filename,
"stderr")))
52 else if (!strcmp (filename,
"syslog"))
54 openlog (
"openvassd", 0, LOG_DAEMON);
59 int fd = open (filename, O_WRONLY | O_CREAT | O_APPEND, 0644);
62 fprintf (stderr,
"log_init():open : %s\n", strerror (errno));
63 fprintf (stderr,
"Could not open the logfile, using stderr\n");
66 log = fdopen (fd,
"a");
86 return log ? fileno (log) : -1;
118 vsyslog (LOG_NOTICE, str, arg_ptr);
125 timestr[
sizeof (timestr) - 1] =
'\0';
126 strncpy (timestr, tmp,
sizeof (timestr) - 1);
127 timestr[strlen (timestr) - 1] =
'\0';
128 fprintf (log,
"[%s][%d] ", timestr, getpid ());
129 vfprintf (log, str, arg_ptr);
144 va_start (param, str);
void log_init(const char *filename)
Initialization of the log file.
void log_write(const char *str,...)
Write into the logfile / syslog.
int log_get_fd()
Get the open log file descriptor.
void log_vwrite(const char *str, va_list arg_ptr)
Write into the logfile / syslog using a va_list.