#include <time.h>
#include <unistd.h>
#include <stdarg.h>
-#include "process.h"
+#include <pthread.h>
+#include "process.h"
#include "debug.h"
const char red_color[] = {
char time[32];
char trace[1024];
char all_trace[1538];
+ char thread_name[16];
const char *color_str = assign_color(color);
int ret;
strftime(time, sizeof(time), "%d.%m.%Y %T", localtime(&t));
+ pthread_getname_np(pthread_self(), thread_name, sizeof(thread_name));
+
ret = snprintf(all_trace, sizeof(all_trace),
- "%s%s [%5d.%d] %s:%d %s %s",
+ "%s%s [%5d.%d] %s %s:%d %s %s",
color_str, time,
getpid(), get_parent_count(),
+ thread_name,
file, line, normal_color, trace);
ret = write(logfile_fd, all_trace, ret);