OpenVAS Libraries  9.0.3
openvas_logging.c
Go to the documentation of this file.
1 /* openvas-libraries/misc
2  * $Id$
3  * Description: Implementation of logging methods for openvas
4  *
5  * Authors:
6  * Laban Mwangi <lmwangi@penguinlabs.co.ke>
7  *
8  * Copyright:
9  * Copyright (C) 2009 PenguinLabs Limited
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2,
13  * or, at your option, any later version as published by the Free
14  * Software Foundation
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
41 #include <stdio.h> /* for fprintf */
42 #include <string.h> /* for strlen */
43 #include <stdlib.h> /* for atoi */
44 #define SYSLOG_NAMES
45 #include <syslog.h> /* for syslog */
46 #undef SYSLOG_NAMES
47 #include <unistd.h> /* for getpid */
48 #include <stdarg.h>
49 #include <libgen.h>
50 #include <errno.h>
51 #include <gnutls/gnutls.h>
52 
53 #include "openvas_logging.h"
54 
55 
61 typedef struct
62 {
63  gchar *log_domain;
64  gchar *prepend_string;
66  gchar *log_file;
67  GLogLevelFlags *default_level;
68  GIOChannel *log_channel;
69  gchar *syslog_facility;
70  gchar *syslog_ident;
72 
73 
81 static void (*legacy_log_handler)(const char *format, va_list args);
82 
83 
95 gchar *
96 get_time (gchar * time_fmt)
97 {
98  time_t now;
99  struct tm *ts;
100  gchar buf[80];
101 
102  /* Get the current time. */
103  now = time (NULL);
104 
105  /* Format and print the time, "ddd yyyy-mm-dd hh:mm:ss zzz." */
106  ts = localtime (&now);
107  strftime (buf, sizeof (buf), time_fmt, ts);
108 
109  return g_strdup_printf ("%s", buf);
110 }
111 
119 static gint
120 level_int_from_string (const gchar * level)
121 {
122  if (level && strlen (level) > 0)
123  {
124  if (level[0] >= '0' && level[0] <= '9')
125  return atoi (level);
126  if (strcasecmp (level, "critical") == 0)
127  return G_LOG_LEVEL_CRITICAL;
128  if (strcasecmp (level, "debug") == 0)
129  return G_LOG_LEVEL_DEBUG;
130  if (strcasecmp (level, "error") == 0)
131  return G_LOG_LEVEL_ERROR;
132  if (strcasecmp (level, "info") == 0)
133  return G_LOG_LEVEL_INFO;
134  if (strcasecmp (level, "message") == 0)
135  return G_LOG_LEVEL_MESSAGE;
136  if (strcasecmp (level, "warning") == 0)
137  return G_LOG_LEVEL_WARNING;
138  }
139  return 0;
140 }
141 
149 static gint
150 facility_int_from_string (const gchar * facility)
151 {
152  if (facility && strlen (facility) > 0)
153  {
154  int i = 0;
155  while (facilitynames[i].c_name != NULL)
156  {
157  if (g_ascii_strcasecmp (facility, facilitynames[i].c_name) == 0)
158  return facilitynames[i].c_val;
159  i++;
160  }
161  }
162  return LOG_LOCAL0;
163 }
164 
175 GSList *
176 load_log_configuration (gchar * config_file)
177 {
178  GKeyFile *key_file;
179  GKeyFileFlags flags;
180  GError *error = NULL;
181  /* key_file *_has_* functions requires this. */
182 
183  // FIXME: If a g_* function that takes error fails, then free error.
184 
185  /* Groups found in the conf file. */
186  gchar **groups;
187  /* Temp variable to iterate over groups. */
188  gchar **group;
189 
190  /* Structure to hold per group settings. */
191  openvas_logging_t *log_domain_entry;
192  /* The link list for the structure above and it's tmp helper */
193  GSList *log_domain_list = NULL;
194 
195  /* Create a new GKeyFile object and a bitwise list of flags. */
196  key_file = g_key_file_new ();
197  flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
198 
199  /* Load the GKeyFile from conf or return. */
200  if (!g_key_file_load_from_file (key_file, config_file, flags, &error))
201  {
202  g_error ("%s: %s", config_file, error->message);
203  }
204 
205  /* Get all the groups available. */
206  groups = g_key_file_get_groups (key_file, NULL);
207 
208  /* Point to the group head. */
209  group = groups;
210  /* Iterate till we get to the end of the array. */
211  while (*group != NULL)
212  {
213  /* Create the struct. */
214  log_domain_entry = g_malloc (sizeof (openvas_logging_t));
215  /* Set the logdomain. */
216  log_domain_entry->log_domain = g_strdup (*group);
217  /* Initialize everything else to NULL. */
218  log_domain_entry->prepend_string = NULL;
219  log_domain_entry->prepend_time_format = NULL;
220  log_domain_entry->log_file = NULL;
221  log_domain_entry->default_level = NULL;
222  log_domain_entry->log_channel = NULL;
223  log_domain_entry->syslog_facility = NULL;
224  log_domain_entry->syslog_ident = NULL;
225 
226 
227  /* Look for the prepend string. */
228  if (g_key_file_has_key (key_file, *group, "prepend", &error))
229  {
230  log_domain_entry->prepend_string =
231  g_key_file_get_value (key_file, *group, "prepend", &error);
232  }
233 
234  /* Look for the prepend time format string. */
235  if (g_key_file_has_key (key_file, *group, "prepend_time_format", &error))
236  {
237  log_domain_entry->prepend_time_format =
238  g_key_file_get_value (key_file, *group, "prepend_time_format",
239  &error);
240  }
241 
242  /* Look for the log file string. */
243  if (g_key_file_has_key (key_file, *group, "file", &error))
244  {
245  log_domain_entry->log_file =
246  g_key_file_get_value (key_file, *group, "file", &error);
247  }
248 
249  /* Look for the prepend log level string. */
250  if (g_key_file_has_key (key_file, *group, "level", &error))
251  {
252  gchar *level;
253 
254  level = g_key_file_get_value (key_file, *group, "level", &error);
255  level = g_strchug (level);
256  log_domain_entry->default_level = g_malloc (sizeof (gint));
257  *log_domain_entry->default_level = level_int_from_string (level);
258  g_free (level);
259  }
260 
261  /* Look for the syslog_facility string. */
262  if (g_key_file_has_key (key_file, *group, "syslog_facility", &error))
263  {
264  log_domain_entry->syslog_facility =
265  g_key_file_get_value (key_file, *group, "syslog_facility", &error);
266  }
267  else
268  log_domain_entry->syslog_facility = "local0";
269 
270  /* Look for the syslog_ident string. */
271  if (g_key_file_has_key (key_file, *group, "syslog_ident", &error))
272  {
273  log_domain_entry->syslog_ident =
274  g_key_file_get_value (key_file, *group, "syslog_ident", &error);
275  }
276  else
277  log_domain_entry->syslog_ident = g_strdup (*group);
278 
279  /* Attach the struct to the list. */
280  log_domain_list = g_slist_prepend (log_domain_list, log_domain_entry);
281  group++;
282  }
283  /* Free the groups array. */
284  g_strfreev (groups);
285 
286  /* Free the key file. */
287  g_key_file_free (key_file);
288 
289  return log_domain_list;
290 }
291 
297 void
298 free_log_configuration (GSList * log_domain_list)
299 {
300  GSList *log_domain_list_tmp;
301  openvas_logging_t *log_domain_entry;
302 
303  /* Free the struct fields then the struct and then go the next
304  * item in the link list.
305  */
306 
307  /* Go the the head of the list. */
308  log_domain_list_tmp = log_domain_list;
309  while (log_domain_list_tmp != NULL)
310  {
311  /* Get the list data which is an openvas_logging_t struct. */
312  log_domain_entry = log_domain_list_tmp->data;
313 
314  /* Free the struct contents. */
315  g_free (log_domain_entry->log_domain);
316  g_free (log_domain_entry->prepend_string);
317  g_free (log_domain_entry->prepend_time_format);
318  g_free (log_domain_entry->log_file);
319  g_free (log_domain_entry->default_level);
320  g_free (log_domain_entry->syslog_ident);
321 
322  /* Drop the reference to the GIOChannel. */
323  if (log_domain_entry->log_channel)
324  g_io_channel_unref (log_domain_entry->log_channel);
325 
326  /* Free the struct. */
327  g_free (log_domain_entry);
328 
329  /* Go to the next item. */
330  log_domain_list_tmp = g_slist_next (log_domain_list_tmp);
331 
332  }
333  /* Free the link list. */
334  g_slist_free (log_domain_list);
335 }
336 
345 void
346 openvas_log_silent (const char *log_domain, GLogLevelFlags log_level,
347  const char *message, gpointer openvas_log_config_list)
348 {
349  (void) log_domain;
350  (void) log_level;
351  (void) message;
352  (void) openvas_log_config_list;
353  return;
354 }
355 
356 static GMutex *logger_mutex = NULL;
357 
358 static void
359 openvas_log_lock_init (void)
360 {
361  if (logger_mutex == NULL)
362  {
363  logger_mutex = g_malloc (sizeof (*logger_mutex));
364  g_mutex_init (logger_mutex);
365  }
366 }
367 
368 static void
369 openvas_log_lock (void)
370 {
371  g_mutex_lock (logger_mutex);
372 }
373 
374 static void
375 openvas_log_unlock (void)
376 {
377  g_mutex_unlock (logger_mutex);
378 }
379 
388 void
389 openvas_log_func (const char *log_domain, GLogLevelFlags log_level,
390  const char *message, gpointer openvas_log_config_list)
391 {
392  gchar *prepend;
393  gchar *prepend_buf;
394  gchar *prepend_tmp;
395  gchar *prepend_tmp1;
396  gchar *tmp;
397  gchar *tmpstr;
398  int messagelen;
399 
400  /* For link list operations. */
401  GSList *log_domain_list_tmp;
402  openvas_logging_t *log_domain_entry = NULL;
403 
404  /* Channel to log through. */
405  GIOChannel *channel;
406  GError *error = NULL;
407 
408  /* The default parameters to be used. The group '*' will override
409  * these defaults if it's found.
410  */
411  gchar *prepend_format = "%p %t - ";
412  gchar *time_format = "%Y-%m-%d %Hh%M.%S %Z";
413 
415  gchar *log_separator = ":";
416  gchar *log_file = "-";
417  GLogLevelFlags default_level = G_LOG_LEVEL_DEBUG;
418  channel = NULL;
419  gchar *syslog_facility = "local0";
420  gchar *syslog_ident = NULL;
421 
422  /* Initialize logger lock if not done. */
423  openvas_log_lock_init ();
424 
425  /* Let's load the default configuration file directives from the
426  * linked list. Scanning the link list twice is inefficient but
427  * leaves the source cleaner.
428  */
429  if (openvas_log_config_list != NULL && log_domain != NULL)
430  {
431 
432  /* Go the the head of the list. */
433  log_domain_list_tmp = (GSList *) openvas_log_config_list;
434 
435  while (log_domain_list_tmp != NULL)
436  {
437  openvas_logging_t *entry;
438 
439  entry = log_domain_list_tmp->data;
440 
441  /* Override defaults if the current linklist group name is '*'. */
442  if (g_ascii_strcasecmp (entry->log_domain, "*") == 0)
443  {
444  /* Get the list data for later use. */
445  log_domain_entry = entry;
446 
447  /* Override defaults if the group items are not null. */
448  if (log_domain_entry->prepend_string)
449  prepend_format = log_domain_entry->prepend_string;
450  if (log_domain_entry->prepend_time_format)
451  time_format = log_domain_entry->prepend_time_format;
452  if (log_domain_entry->log_file)
453  log_file = log_domain_entry->log_file;
454  if (log_domain_entry->default_level)
455  default_level = *log_domain_entry->default_level;
456  if (log_domain_entry->log_channel)
457  channel = log_domain_entry->log_channel;
458  if (log_domain_entry->syslog_facility)
459  syslog_facility = log_domain_entry->syslog_facility;
460  break;
461  }
462 
463  /* Go to the next item. */
464  log_domain_list_tmp = g_slist_next (log_domain_list_tmp);
465  }
466  }
467 
468  /* Let's load the configuration file directives if a linked list item for
469  * the log domain group exists.
470  */
471  if (openvas_log_config_list != NULL && log_domain != NULL)
472  {
473 
474  /* Go the the head of the list. */
475  log_domain_list_tmp = (GSList *) openvas_log_config_list;
476 
477  while (log_domain_list_tmp != NULL)
478  {
479  openvas_logging_t *entry;
480 
481  entry = log_domain_list_tmp->data;
482 
483  /* Search for the log domain in the link list. */
484  if (g_ascii_strcasecmp (entry->log_domain, log_domain) == 0)
485  {
486  /* Get the list data which is an openvas_logging_t struct. */
487  log_domain_entry = entry;
488 
489  /* Get the struct contents. */
490  prepend_format = log_domain_entry->prepend_string;
491  time_format = log_domain_entry->prepend_time_format;
492  log_file = log_domain_entry->log_file;
493  if (log_domain_entry->default_level)
494  default_level = *log_domain_entry->default_level;
495  channel = log_domain_entry->log_channel;
496  syslog_facility = log_domain_entry->syslog_facility;
497  syslog_ident = log_domain_entry->syslog_ident;
498  break;
499  }
500 
501  /* Go to the next item. */
502  log_domain_list_tmp = g_slist_next (log_domain_list_tmp);
503  }
504  }
505 
506  /* If the current log entry is less severe than the specified log level,
507  * let's exit.
508  */
509  if (default_level < log_level)
510  return;
511 
512 
513  /* Prepend buf is a newly allocated empty string. Makes life easier. */
514  prepend_buf = g_strdup ("");
515 
516 
517  /* Make the tmp pointer (for iteration) point to the format string. */
518  tmp = prepend_format;
519 
520  while (*tmp != '\0')
521  {
522  /* If the current char is a % and the next one is a p, get the pid. */
523  if ((*tmp == '%') && (*(tmp + 1) == 'p'))
524  {
525  /* Use g_strdup, a new string returned. Store it in a tmp var until
526  * we free the old one. */
527  prepend_tmp =
528  g_strdup_printf ("%s%s%d", prepend_buf, log_separator,
529  (int) getpid ());
530  /* Free the old string. */
531  g_free (prepend_buf);
532  /* Point the buf ptr to the new string. */
533  prepend_buf = prepend_tmp;
534  /* Skip over the two chars we've processed '%p'. */
535  tmp += 2;
536  }
537  else if ((*tmp == '%') && (*(tmp + 1) == 't'))
538  {
539  /* Get time returns a newly allocated string.
540  * Store it in a tmp var.
541  */
542  prepend_tmp1 = get_time (time_format);
543  /* Use g_strdup. New string returned. Store it in a tmp var until
544  * we free the old one.
545  */
546  prepend_tmp =
547  g_strdup_printf ("%s%s%s", prepend_buf, log_separator,
548  prepend_tmp1);
549  /* Free the time tmp var. */
550  g_free (prepend_tmp1);
551  /* Free the old string. */
552  g_free (prepend_buf);
553  /* Point the buf ptr to the new string. */
554  prepend_buf = prepend_tmp;
555  /* Skip over the two chars we've processed '%t.' */
556  tmp += 2;
557  }
558  else
559  {
560  /* Jump to the next character. */
561  tmp++;
562  }
563  }
564 
565  /* Step through all possible messages prefixing them with an appropriate
566  * tag.
567  */
568  switch (log_level)
569  {
570  case G_LOG_FLAG_RECURSION:
571  prepend = g_strdup_printf ("RECURSION%s", prepend_buf);
572  break;
573 
574  case G_LOG_FLAG_FATAL:
575  prepend = g_strdup_printf ("FATAL%s", prepend_buf);
576  break;
577 
578  case G_LOG_LEVEL_ERROR:
579  prepend = g_strdup_printf ("ERROR%s", prepend_buf);
580  break;
581 
582  case G_LOG_LEVEL_CRITICAL:
583  prepend = g_strdup_printf ("CRITICAL%s", prepend_buf);
584  break;
585 
586  case G_LOG_LEVEL_WARNING:
587  prepend = g_strdup_printf ("WARNING%s", prepend_buf);
588  break;
589 
590  case G_LOG_LEVEL_MESSAGE:
591  prepend = g_strdup_printf ("MESSAGE%s", prepend_buf);
592  break;
593 
594  case G_LOG_LEVEL_INFO:
595  prepend = g_strdup_printf (" INFO%s", prepend_buf);
596  break;
597 
598  case G_LOG_LEVEL_DEBUG:
599  prepend = g_strdup_printf (" DEBUG%s", prepend_buf);
600  break;
601 
602  default:
603  prepend = g_strdup_printf ("UNKNOWN%s", prepend_buf);
604  break;
605  }
606 
607  /* If the current log entry is more severe than the specified log
608  * level, print out the message. In case MESSAGE already ends in a
609  * LF and there is not only the LF, remove the LF to avoid empty
610  * lines in the log.
611  */
612  messagelen = message? strlen (message) : 0;
613  if (messagelen > 1 && message[messagelen-1] == '\n')
614  messagelen--;
615  tmpstr = g_strdup_printf ("%s%s%s%s %.*s\n",
616  log_domain ? log_domain : "", log_separator,
617  prepend, log_separator, messagelen, message);
618  g_free (prepend);
619 
620  openvas_log_lock ();
621  /* Output everything to stderr if logfile is "-". */
622  if (g_ascii_strcasecmp (log_file, "-") == 0)
623  {
624  fprintf (stderr, "%s", tmpstr);
625  fflush (stderr);
626  }
627  /* Output everything to syslog if logfile is "syslog" */
628  else if (g_ascii_strcasecmp (log_file, "syslog") == 0)
629  {
630  int facility = facility_int_from_string (syslog_facility);
631  int syslog_level = LOG_INFO;
632 
633  openlog (syslog_ident, LOG_CONS | LOG_PID | LOG_NDELAY, facility);
634 
635  switch (log_level)
636  {
637  case G_LOG_FLAG_FATAL:
638  syslog_level = LOG_ALERT;
639  break;
640  case G_LOG_LEVEL_ERROR:
641  syslog_level = LOG_ERR;
642  break;
643  case G_LOG_LEVEL_CRITICAL:
644  syslog_level = LOG_CRIT;
645  break;
646  case G_LOG_LEVEL_WARNING:
647  syslog_level = LOG_WARNING;
648  break;
649  case G_LOG_LEVEL_MESSAGE:
650  syslog_level = LOG_NOTICE;
651  break;
652  case G_LOG_LEVEL_INFO:
653  syslog_level = LOG_INFO;
654  break;
655  case G_LOG_LEVEL_DEBUG:
656  syslog_level = LOG_DEBUG;
657  break;
658  default:
659  syslog_level = LOG_INFO;
660  break;
661  }
662 
663  syslog (syslog_level, "%s", message);
664 
665  closelog ();
666  }
667  else
668  {
669  /* Open a channel and store it in the struct or
670  * retrieve and use an already existing channel.
671  */
672  if (channel == NULL)
673  {
674  channel = g_io_channel_new_file (log_file, "a", &error);
675  if (!channel)
676  {
677  gchar *log = g_strdup (log_file);
678  gchar *dir = dirname (log);
679 
681  g_error_free (error);
682 
683  /* Ensure directory exists. */
684  if (g_mkdir_with_parents (dir, 0755)) /* "rwxr-xr-x" */
685  {
686  g_warning ("Failed to create log file directory %s: %s", dir,
687  strerror (errno));
688  g_free (log);
689  g_free (tmpstr);
690  g_free (prepend_buf);
691  return;
692  }
693  g_free (log);
694 
695  /* Try again. */
696  error = NULL;
697  channel = g_io_channel_new_file (log_file, "a", &error);
698  if (!channel)
699  {
700  g_error ("Can not open '%s' logfile: %s", log_file,
701  error->message);
702  }
703  }
704 
705  /* Store it in the struct for later use. */
706  if (log_domain_entry != NULL)
707  log_domain_entry->log_channel = channel;
708  }
709  g_io_channel_write_chars (channel, (const gchar *) tmpstr, -1, NULL,
710  &error);
711  g_io_channel_flush (channel, NULL);
712 
713  }
714  openvas_log_unlock ();
715  g_free (tmpstr);
716  g_free (prepend_buf);
717 }
718 
719 
727 static void
728 log_func_for_gnutls (int level, const char *message)
729 {
730  g_log ("x gnutls", G_LOG_LEVEL_INFO, "tls(%d): %s", level, message);
731 }
732 
733 
741 void
742 setup_log_handlers (GSList * openvas_log_config_list)
743 {
744  GSList *log_domain_list_tmp;
745  openvas_logging_t *log_domain_entry;
746  if (openvas_log_config_list != NULL)
747  {
748  /* Go to the head of the list. */
749  log_domain_list_tmp = (GSList *) openvas_log_config_list;
750 
751  while (log_domain_list_tmp != NULL)
752  {
753  /* Get the list data which is an openvas_logging_t struct. */
754  log_domain_entry = log_domain_list_tmp->data;
755 
756  GLogFunc logfunc =
757 #if 0
758  (!strcmp (log_domain_entry, "syslog")) ? openvas_syslog_func :
759 #endif
761 
762  if (g_ascii_strcasecmp (log_domain_entry->log_domain, "*"))
763  {
764  g_log_set_handler (log_domain_entry->log_domain,
765  (GLogLevelFlags) (G_LOG_LEVEL_DEBUG |
766  G_LOG_LEVEL_INFO |
767  G_LOG_LEVEL_MESSAGE |
768  G_LOG_LEVEL_WARNING |
769  G_LOG_LEVEL_CRITICAL |
770  G_LOG_LEVEL_ERROR |
771  G_LOG_FLAG_FATAL |
772  G_LOG_FLAG_RECURSION),
773  (GLogFunc) logfunc, openvas_log_config_list);
774  }
775  else
776  {
777  g_log_set_default_handler ((GLogFunc) logfunc,
778  openvas_log_config_list);
779  }
780 
781  /* Go to the next item. */
782  log_domain_list_tmp = g_slist_next (log_domain_list_tmp);
783  }
784  }
785  g_log_set_handler ("",
786  (GLogLevelFlags) (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO |
787  G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_WARNING
788  | G_LOG_LEVEL_CRITICAL |
789  G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL |
790  G_LOG_FLAG_RECURSION),
791  (GLogFunc) openvas_log_func, openvas_log_config_list);
792 
793  /* Check whether GNUTLS debugging has been enabled. */
794  {
795  const char *s;
796  if ((s=getenv ("OPENVAS_GNUTLS_DEBUG")))
797  {
798  gnutls_global_set_log_function (log_func_for_gnutls);
799  gnutls_global_set_log_level (atoi (s));
800  }
801  }
802 }
803 
804 
816 void
817 setup_legacy_log_handler (void (*handler)(const char *, va_list))
818 {
819  legacy_log_handler = handler;
820 }
821 
822 
831 void
832 log_legacy_write (const char *format, ...)
833 {
834  va_list arg_ptr;
835 
836  va_start (arg_ptr, format);
837  if (legacy_log_handler)
838  legacy_log_handler (format, arg_ptr);
839  else
840  vfprintf (stderr, format, arg_ptr);
841  va_end (arg_ptr);
842 }
843 
850 void
852 {
853  if (!legacy_log_handler)
854  fflush (stderr);
855 }
GLogLevelFlags * default_level
What severity level to use as default.
gchar * log_file
Where to log to.
gchar * prepend_string
Prepend this string before every message.
GIOChannel * log_channel
Gio Channel - FD holder for logfile.
void free_log_configuration(GSList *log_domain_list)
Frees all resources loaded by the config loader.
void setup_log_handlers(GSList *openvas_log_config_list)
Sets up routing of logdomains to log handlers.
gchar * prepend_time_format
If prependstring has t, format for strftime.
void log_legacy_write(const char *format,...)
Legacy function to write a log message.
void log_legacy_fflush(void)
Legacy function to flush a log message.
GSList * load_log_configuration(gchar *config_file)
Loads parameters from a config file into a linked list.
gchar * log_domain
Affected logdomain e.g libnasl.
gchar * syslog_ident
Syslog ident to use for syslog logging.
gchar * syslog_facility
Syslog facility to use for syslog logging.
void setup_legacy_log_handler(void(*handler)(const char *, va_list))
Sets up a simple logging function.
gchar * get_time(gchar *time_fmt)
Returns time as specified in time_fmt strftime format.
void openvas_log_func(const char *log_domain, GLogLevelFlags log_level, const char *message, gpointer openvas_log_config_list)
Creates the formatted string and outputs it to the log destination.
void openvas_log_silent(const char *log_domain, GLogLevelFlags log_level, const char *message, gpointer openvas_log_config_list)
Returns immediately.