Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
src/log.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/log.c b/src/log.c
index 614a855..fc516bc 100644
--- a/src/log.c
+++ b/src/log.c
@@ -21,6 +21,8 @@
#include <pthread.h>
#include <sys/socket.h>
#include <sys/time.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
#include <stdarg.h>
#include "sanlock_internal.h"
@@ -120,6 +122,7 @@ void log_level(uint32_t space_id, uint32_t token_id, char *name_in, int level, c
int len = LOG_STR_LEN - 2; /* leave room for \n\0 */
struct timeval cur_time;
struct tm time_info;
+ pid_t tid;
memset(name, 0, sizeof(name));
@@ -137,11 +140,13 @@ void log_level(uint32_t space_id, uint32_t token_id, char *name_in, int level, c
gettimeofday(&cur_time, NULL);
localtime_r(&cur_time.tv_sec, &time_info);
ret = strftime(log_str + pos, len - pos,
- "%Y-%m-%d %H:%M:%S%z: ", &time_info);
+ "%Y-%m-%d %H:%M:%S%z ", &time_info);
pos += ret;
- ret = snprintf(log_str + pos, len - pos, "%llu %s",
- (unsigned long long)monotime(), name);
+ tid = syscall(SYS_gettid);
+
+ ret = snprintf(log_str + pos, len - pos, "%llu [%u]: %s",
+ (unsigned long long) monotime(), tid, name);
pos += ret;
va_start(ap, fmt);
--
1.7.1