LIBSSDP
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Macros
include
log.h
Go to the documentation of this file.
1
7
#ifndef __LOG_H__
8
#define __LOG_H__
9
10
#include <stdio.h>
11
12
#include "
common_definitions.h
"
13
15
#define DEBUG___
16
17
#define DEBUG_TO_FILE___
18
20
#define ANSI_COLOR_PURPLE "\x1b[1;35m"
21
22
#define ANSI_COLOR_GRAY "\x1b[0;90m"
23
24
#define ANSI_COLOR_GREEN "\x1b[0;32m"
25
26
#define ANSI_COLOR_DEFAULT "\x1b[0;39m"
27
28
#define ANSI_COLOR_YELLOW "\x1b[0;33m"
29
30
#define ANSI_COLOR_RED "\x1b[0;31m"
31
32
#define ANSI_COLOR_RESET "\x1b[0m"
33
34
#ifdef DEBUG___
35
#define PRINT_DEV(...) print_debug(NULL, ANSI_COLOR_PURPLE, __FILE__, \
36
__LINE__, __VA_ARGS__)
37
#define PRINT_DEBUG(...) print_debug(NULL, ANSI_COLOR_GRAY, __FILE__, \
38
__LINE__, __VA_ARGS__)
39
#define PRINT_INFO(...) print_debug(NULL, ANSI_COLOR_DEFAULT, __FILE__, \
40
__LINE__, __VA_ARGS__)
41
#define PRINT_WARN(...) print_debug(NULL, ANSI_COLOR_YELLOW, __FILE__, \
42
__LINE__, __VA_ARGS__)
43
#define PRINT_ERROR(...) print_debug(stderr, ANSI_COLOR_RED, __FILE__, \
44
__LINE__, __VA_ARGS__)
45
#else
46
#define PRINT_DEV(...) do { } while (FALSE)
47
#define PRINT_DEBUG(...) do { } while (FALSE)
48
#define PRINT_INFO(...) fprintf(stderr, "[INFO] " __VA_ARGS__)
49
#define PRINT_WARN(...) fprintf(stderr, "[WARN] " __VA_ARGS__)
50
#define PRINT_ERROR(...) fprintf(stderr, "[ERR] " __VA_ARGS__)
51
#endif
52
53
#ifdef DEBUG___
54
66
void
print_debug
(FILE *std,
const
char
*color,
const
char
* file,
int
line,
67
char
*va_format, ...);
68
#endif
69
76
void
log_start_args
(
int
argc,
char
**argv);
77
78
#endif
/* __LOG_H__ */
common_definitions.h
log_start_args
void log_start_args(int argc, char **argv)
Definition:
log.c:219
print_debug
void print_debug(FILE *std, const char *color, const char *file, int line, char *va_format,...)
Definition:
log.c:60
Generated on Mon Jun 12 2017 08:54:20 for LIBSSDP by
1.8.8