Flowgrind
Advanced TCP traffic generator
fg_log.h File Reference
#include "config.h"

Go to the source code of this file.

Enumerations

enum  log_streams { LOGGING_SYSLOG = 0, LOGGING_STDERR, LOGGING_STDOUT }
 Supported output streams for logging. More...
 

Functions

void close_logging (void)
 Close logging stream. More...
 
void init_logging (enum log_streams stream)
 Open logging stream. More...
 
void logging (int priority, const char *fmt,...) __attribute__((format(printf
 Submit log message fmt to logging stream. More...
 
void void vlogging (int priority, const char *fmt, va_list ap) __attribute__((format(printf
 Submit log message fmt to logging stream. More...
 

Enumeration Type Documentation

Supported output streams for logging.

Enumerator
LOGGING_SYSLOG 

Log to syslog.

LOGGING_STDERR 

Log to stderr.

LOGGING_STDOUT 

Log to stdout.

Definition at line 37 of file fg_log.h.

37  {
39  LOGGING_SYSLOG = 0,
44 };
Log to stderr.
Definition: fg_log.h:41
Log to syslog.
Definition: fg_log.h:39
Log to stdout.
Definition: fg_log.h:43

Function Documentation

void close_logging ( void  )

Close logging stream.

Definition at line 57 of file fg_log.c.

58 {
59  switch (log_stream) {
60  case LOGGING_SYSLOG:
61  closelog();
62  break;
63  case LOGGING_STDERR:
64  case LOGGING_STDOUT:
65  break;
66  }
67 }
Log to stderr.
Definition: fg_log.h:41
Log to syslog.
Definition: fg_log.h:39
Log to stdout.
Definition: fg_log.h:43
static enum log_streams log_stream
Definition: fg_log.c:41
void init_logging ( enum log_streams  stream)

Open logging stream.

Parameters
[in]streamto which output stream we log

Definition at line 43 of file fg_log.c.

44 {
45  log_stream = stream;
46 
47  switch (log_stream) {
48  case LOGGING_SYSLOG:
49  openlog("flowgrindd", LOG_NDELAY | LOG_CONS | LOG_PID, LOG_DAEMON);
50  break;
51  case LOGGING_STDERR:
52  case LOGGING_STDOUT:
53  break;
54  }
55 }
Log to stderr.
Definition: fg_log.h:41
Log to syslog.
Definition: fg_log.h:39
Log to stdout.
Definition: fg_log.h:43
static enum log_streams log_stream
Definition: fg_log.c:41
void logging ( int  priority,
const char *  fmt,
  ... 
)

Submit log message fmt to logging stream.

Parameters
[in]prioritypriority code of log message
[in]fmtformat string
[in]...parameters used to fill fmt
void void vlogging ( int  priority,
const char *  fmt,
va_list  ap 
)

Submit log message fmt to logging stream.

Parameters
[in]prioritypriority code of log message
[in]fmtformat string
[in]apparameters used to fill fmt