#ifndef __DEBUG_H
#define __DEBUG_H
+#include <time.h>
#include <unistd.h>
#include "process.h"
#define pr_info(fmt, arg...) \
do { \
+ time_t t = time(0); \
char indent[16] = { " " }; \
+ char time[32]; \
+ \
+ strftime(time, sizeof(time), "%d.%m.%Y %T ", \
+ localtime(&t)); \
indent[get_parent_count()] = 0; \
- fprintf(stderr, "%s%s[%5d.%d] %s:%d %s" \
- fmt, indent, green_color, \
+ \
+ fprintf(stderr, "%s%s %s[%5d.%d] %s:%d %s" \
+ fmt, green_color, time, indent, \
getpid(), get_sibling_count(), \
__FILE__, __LINE__, normal_color, ##arg); \
} while (0)
#define pr_err(fmt, arg...) \
do { \
+ time_t t = time(0); \
char indent[16] = { " " }; \
+ char time[32]; \
+ \
+ strftime(time, sizeof(time), "%d.%m.%Y %T ", \
+ localtime(&t)); \
indent[get_parent_count()] = 0; \
- fprintf(stderr, "%s%s[%5d.%d] %s:%d Error %s" \
- fmt, indent, red_color, \
+ \
+ fprintf(stderr, "%s%s %s[%5d.%d] %s:%d Error %s" \
+ fmt, red_color, time, indent, \
getpid(), get_sibling_count(), \
__FILE__, __LINE__, normal_color, ##arg); \
} while (0)