.travis.yml: Add compilation with gcc 5 and gcc 6
[ccan] / junkcode / henryeshbaugh@gmail.com-log / log.h
1 #ifndef CCAN_LOG_H
2 #define CCAN_LOG_H
3
4 #include <stdio.h>
5 #include <string.h>
6 #include <stdbool.h>
7 #include <stdarg.h>
8 #include <time.h>
9
10 #define LOG_CRITICAL 0
11 #define LOG_ERROR    1
12 #define LOG_WARNING  2
13 #define LOG_INFO     3
14 #define LOG_INVALID  4
15
16 static 
17 char *log_tags[2][5] = { { "[CRITICAL] ",
18                            "[ERROR]    ",
19                            "[WARNING]  ",
20                            "[INFO]     ", 
21                            "[INVALID LOG LEVEL] "},
22                        {   "[!] ",
23                            "[*] ",
24                            "[-] ",
25                            "[+] ",
26                            "[~] " }};
27
28 #define LOG_VERBOSE 0
29 #define LOG_CONCISE 1
30
31 extern FILE *set_log_file(char *);
32 extern int get_log_mode();
33 extern void set_log_mode(int);
34
35 #define print_log(level, ...) do {                              \
36                                 time_t _clk = time(NULL);       \
37                                 _print_log(level, __FILE__, __func__, ctime(&_clk), __LINE__, __VA_ARGS__); \
38                              } while (0)
39
40 extern void _print_log(int, char *, const char *, char*, int, char *, ...);
41 #endif // CCAN_LOG_H