summaryrefslogtreecommitdiff
path: root/client/debug.h
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2009-11-17 16:47:41 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-11-18 13:36:43 +0200
commit56eb1acb9e7792faedf8c23d4e1435f1ec2b36b8 (patch)
tree546a16c898146ac6cd7db01ea871ba0886426443 /client/debug.h
parent8b36ed546068bd365c1345f937f3b26cd2b7d0d4 (diff)
spice: add [pid:tid] to log lines
Diffstat (limited to 'client/debug.h')
-rw-r--r--client/debug.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/client/debug.h b/client/debug.h
index cf84296c..1c6f6a42 100644
--- a/client/debug.h
+++ b/client/debug.h
@@ -24,6 +24,8 @@
#include <log4cpp/Category.hh>
#include <log4cpp/convenience.h>
+#include "platform.h"
+
#ifdef WIN32
#define snprintf _snprintf
#endif
@@ -74,10 +76,11 @@ static inline std::string pretty_func_to_func_name(const std::string& f_name)
LOG4CPP_LOGGER("spice")
-#define LOG(type, format, ...) { \
- std::string log_message; \
- string_printf(log_message, "%s: " format, FUNC_NAME, ## __VA_ARGS__); \
- LOG4CPP_##type(logger, log_message.c_str()); \
+#define LOG(type, format, ...) { \
+ std::string log_message; \
+ string_printf(log_message, "[%llu:%llu] %s: " format, Platform::get_process_id(), \
+ Platform::get_thread_id(), FUNC_NAME, ## __VA_ARGS__); \
+ LOG4CPP_##type(logger, log_message.c_str()); \
}
#define LOG_INFO(format, ...) LOG(INFO, format, ## __VA_ARGS__)