Loading...
Searching...
No Matches
Variables
debug.h File Reference

Logging and Debugging. More...

#include <inttypes.h>
#include <glib.h>
#include <glib/gprintf.h>
Include dependency graph for debug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

imquic log colors
#define IMQUIC_ANSI_COLOR_RED   "\x1b[31m"
 
#define IMQUIC_ANSI_COLOR_GREEN   "\x1b[32m"
 
#define IMQUIC_ANSI_COLOR_YELLOW   "\x1b[33m"
 
#define IMQUIC_ANSI_COLOR_BLUE   "\x1b[34m"
 
#define IMQUIC_ANSI_COLOR_MAGENTA   "\x1b[35m"
 
#define IMQUIC_ANSI_COLOR_CYAN   "\x1b[36m"
 
#define IMQUIC_ANSI_COLOR_RESET   "\x1b[0m"
 
imquic log wrappers
#define IMQUIC_PRINT   g_print
 Simple wrapper to g_print/printf.
 
#define IMQUIC_LOG(level, format, ...)
 Logger based on different levels, which can either be displayed or not according to the configuration of the server. The format must be a string literal.
 

Variables

int imquic_log_level
 
gboolean imquic_log_timestamps
 
gboolean imquic_log_colors
 

imquic log levels

#define IMQUIC_LOG_NONE   (0)
 No debugging.
 
#define IMQUIC_LOG_FATAL   (1)
 Fatal error.
 
#define IMQUIC_LOG_ERR   (2)
 Non-fatal error.
 
#define IMQUIC_LOG_WARN   (3)
 Warning.
 
#define IMQUIC_LOG_INFO   (4)
 Informational message.
 
#define IMQUIC_LOG_VERB   (5)
 Verbose message.
 
#define IMQUIC_LOG_HUGE   (6)
 Overly verbose message.
 
#define IMQUIC_LOG_DBG   (7)
 Debug message (includes .c filename, function and line number)
 
#define IMQUIC_LOG_MAX   IMQUIC_LOG_DBG
 Maximum level of debugging.
 

Detailed Description

Logging and Debugging.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Implementation of a wrapper on printf (or g_print) to either log or debug.

Macro Definition Documentation

◆ IMQUIC_ANSI_COLOR_BLUE

#define IMQUIC_ANSI_COLOR_BLUE   "\x1b[34m"

◆ IMQUIC_ANSI_COLOR_CYAN

#define IMQUIC_ANSI_COLOR_CYAN   "\x1b[36m"

◆ IMQUIC_ANSI_COLOR_GREEN

#define IMQUIC_ANSI_COLOR_GREEN   "\x1b[32m"

◆ IMQUIC_ANSI_COLOR_MAGENTA

#define IMQUIC_ANSI_COLOR_MAGENTA   "\x1b[35m"

◆ IMQUIC_ANSI_COLOR_RED

#define IMQUIC_ANSI_COLOR_RED   "\x1b[31m"

◆ IMQUIC_ANSI_COLOR_RESET

#define IMQUIC_ANSI_COLOR_RESET   "\x1b[0m"

◆ IMQUIC_ANSI_COLOR_YELLOW

#define IMQUIC_ANSI_COLOR_YELLOW   "\x1b[33m"

◆ IMQUIC_LOG

#define IMQUIC_LOG ( level,
format,
... )
Value:
do { \
if (level > IMQUIC_LOG_NONE && level <= IMQUIC_LOG_MAX && level <= imquic_log_level) { \
char imquic_log_ts[64] = ""; \
char imquic_log_src[128] = ""; \
struct tm imquictmresult; \
time_t imquicltime = time(NULL); \
localtime_r(&imquicltime, &imquictmresult); \
strftime(imquic_log_ts, sizeof(imquic_log_ts), \
"[%a %b %e %T %Y] ", &imquictmresult); \
} \
if (level == IMQUIC_LOG_FATAL || level == IMQUIC_LOG_ERR || level == IMQUIC_LOG_DBG) { \
snprintf(imquic_log_src, sizeof(imquic_log_src), \
"[%s:%s:%d] ", __FILE__, __FUNCTION__, __LINE__); \
} \
g_print("%s%s%s" format, \
imquic_log_ts, \
imquic_log_prefix[level | ((int)imquic_log_colors << 3)], \
imquic_log_src, \
##__VA_ARGS__); \
} \
} while (0)
#define IMQUIC_LOG_FATAL
Fatal error.
Definition debug.h:40
#define IMQUIC_LOG_ERR
Non-fatal error.
Definition debug.h:42
#define IMQUIC_LOG_MAX
Maximum level of debugging.
Definition debug.h:54
#define IMQUIC_LOG_NONE
No debugging.
Definition debug.h:38
#define IMQUIC_LOG_DBG
Debug message (includes .c filename, function and line number)
Definition debug.h:52
int imquic_log_level
Definition imquic.c:26
gboolean imquic_log_timestamps
Definition imquic.c:27
gboolean imquic_log_colors
Definition imquic.c:28

Logger based on different levels, which can either be displayed or not according to the configuration of the server. The format must be a string literal.

◆ IMQUIC_LOG_DBG

#define IMQUIC_LOG_DBG   (7)

Debug message (includes .c filename, function and line number)

◆ IMQUIC_LOG_ERR

#define IMQUIC_LOG_ERR   (2)

Non-fatal error.

◆ IMQUIC_LOG_FATAL

#define IMQUIC_LOG_FATAL   (1)

Fatal error.

◆ IMQUIC_LOG_HUGE

#define IMQUIC_LOG_HUGE   (6)

Overly verbose message.

◆ IMQUIC_LOG_INFO

#define IMQUIC_LOG_INFO   (4)

Informational message.

◆ IMQUIC_LOG_MAX

#define IMQUIC_LOG_MAX   IMQUIC_LOG_DBG

Maximum level of debugging.

◆ IMQUIC_LOG_NONE

#define IMQUIC_LOG_NONE   (0)

No debugging.

◆ IMQUIC_LOG_VERB

#define IMQUIC_LOG_VERB   (5)

Verbose message.

◆ IMQUIC_LOG_WARN

#define IMQUIC_LOG_WARN   (3)

Warning.

◆ IMQUIC_PRINT

#define IMQUIC_PRINT   g_print

Simple wrapper to g_print/printf.

Variable Documentation

◆ imquic_log_colors

gboolean imquic_log_colors
extern

◆ imquic_log_level

int imquic_log_level
extern

◆ imquic_log_timestamps

gboolean imquic_log_timestamps
extern