LIBSSDP
 All Classes Files Functions Variables Typedefs Macros
Macros | Functions
log.h File Reference
#include <stdio.h>
#include "common_definitions.h"
Include dependency graph for log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUG___
 
#define DEBUG_TO_FILE___
 
#define ANSI_COLOR_PURPLE   "\x1b[1;35m"
 
#define ANSI_COLOR_GRAY   "\x1b[0;90m"
 
#define ANSI_COLOR_GREEN   "\x1b[0;32m"
 
#define ANSI_COLOR_DEFAULT   "\x1b[0;39m"
 
#define ANSI_COLOR_YELLOW   "\x1b[0;33m"
 
#define ANSI_COLOR_RED   "\x1b[0;31m"
 
#define ANSI_COLOR_RESET   "\x1b[0m"
 
#define PRINT_DEV(...)
 
#define PRINT_DEBUG(...)
 
#define PRINT_INFO(...)
 
#define PRINT_WARN(...)
 
#define PRINT_ERROR(...)
 

Functions

void print_debug (FILE *std, const char *color, const char *file, int line, char *va_format,...)
 
void log_start_args (int argc, char **argv)
 

Detailed Description

The logging system header file.

Definition in file log.h.

Macro Definition Documentation

#define ANSI_COLOR_DEFAULT   "\x1b[0;39m"

Terminal code for the default color

Definition at line 26 of file log.h.

#define ANSI_COLOR_GRAY   "\x1b[0;90m"

Terminal code for the color gray

Definition at line 22 of file log.h.

#define ANSI_COLOR_GREEN   "\x1b[0;32m"

Terminal code for the color green

Definition at line 24 of file log.h.

#define ANSI_COLOR_PURPLE   "\x1b[1;35m"

Terminal code for the purple color

Definition at line 20 of file log.h.

#define ANSI_COLOR_RED   "\x1b[0;31m"

Terminal code for the color red

Definition at line 30 of file log.h.

#define ANSI_COLOR_RESET   "\x1b[0m"

Terminal code for resetting the color

Definition at line 32 of file log.h.

#define ANSI_COLOR_YELLOW   "\x1b[0;33m"

Terminal code for the color yellow

Definition at line 28 of file log.h.

#define DEBUG___

Uncomment this line to enable detailed debug information

Definition at line 15 of file log.h.

#define DEBUG_TO_FILE___

Uncomment this line to write to a to a file instead of stdout

Definition at line 17 of file log.h.

#define PRINT_DEBUG (   ...)
Value:
print_debug(NULL, ANSI_COLOR_GRAY, __FILE__, \
__LINE__, __VA_ARGS__)
#define ANSI_COLOR_GRAY
Definition: log.h:22
void print_debug(FILE *std, const char *color, const char *file, int line, char *va_format,...)
Definition: log.c:60

Definition at line 37 of file log.h.

#define PRINT_DEV (   ...)
Value:
print_debug(NULL, ANSI_COLOR_PURPLE, __FILE__, \
__LINE__, __VA_ARGS__)
void print_debug(FILE *std, const char *color, const char *file, int line, char *va_format,...)
Definition: log.c:60
#define ANSI_COLOR_PURPLE
Definition: log.h:20

Definition at line 35 of file log.h.

#define PRINT_ERROR (   ...)
Value:
print_debug(stderr, ANSI_COLOR_RED, __FILE__, \
__LINE__, __VA_ARGS__)
#define ANSI_COLOR_RED
Definition: log.h:30
void print_debug(FILE *std, const char *color, const char *file, int line, char *va_format,...)
Definition: log.c:60

Definition at line 43 of file log.h.

#define PRINT_INFO (   ...)
Value:
print_debug(NULL, ANSI_COLOR_DEFAULT, __FILE__, \
__LINE__, __VA_ARGS__)
#define ANSI_COLOR_DEFAULT
Definition: log.h:26
void print_debug(FILE *std, const char *color, const char *file, int line, char *va_format,...)
Definition: log.c:60

Definition at line 39 of file log.h.

#define PRINT_WARN (   ...)
Value:
print_debug(NULL, ANSI_COLOR_YELLOW, __FILE__, \
__LINE__, __VA_ARGS__)
#define ANSI_COLOR_YELLOW
Definition: log.h:28
void print_debug(FILE *std, const char *color, const char *file, int line, char *va_format,...)
Definition: log.c:60

Definition at line 41 of file log.h.

Function Documentation

void log_start_args ( int  argc,
char **  argv 
)

Logs the command line arguments the process was started with.

Parameters
argcThe argc passed to the program/lib.
argvThe argv passed to the program/lib.

Definition at line 219 of file log.c.

void print_debug ( FILE *  std,
const char *  color,
const char *  file,
int  line,
char *  va_format,
  ... 
)

Prints a debug message, mimicking printf-like function, supports only d, s and c

Parameters
stdStandard output to use. color Color to print the message in.
fileThe file the debug message generated in.
lineThe line number in the file the debug message generated at.
messageThe debug message to be displayed.
...Variable number of optional arguments that match with the va_format.

Definition at line 60 of file log.c.