summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-29 01:20:21 -0800
committerPixel <pixel@nobis-crew.org>2011-11-29 01:20:21 -0800
commit07b2ec5910e103fc38daa55d0fd0e931b66f5626 (patch)
tree426d3a5e49cb22b380f7e2c50a23b507606486b4 /src
parent7e19ed346d2305dd63edd01ed8aa79e0dfb02d01 (diff)
Adding detailled logs, with timestamp and threadid.
Diffstat (limited to 'src')
-rw-r--r--src/Printer.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Printer.cc b/src/Printer.cc
index 9216ec8..026ee1a 100644
--- a/src/Printer.cc
+++ b/src/Printer.cc
@@ -1,3 +1,4 @@
+#include "ev++.h"
#include "Printer.h"
#include "Main.h"
#include "Local.h"
@@ -15,7 +16,10 @@ static const char * prefixes[] = {
"(**) ",
};
-Balau::Printer::Printer() : m_verbosity(M_STATUS | M_WARNING | M_ERROR | M_ENGINE_DEBUG) {
+Balau::Printer::Printer() : m_verbosity(M_STATUS | M_WARNING | M_ERROR | M_ENGINE_DEBUG), m_detailledLogs(false) {
+#ifdef DEBUG
+ m_detailledLogs = true;
+#endif
if (!localPrinter.getGlobal())
localPrinter.setGlobal(this);
}
@@ -37,6 +41,12 @@ void Balau::Printer::_log(uint32_t level, const char * fmt, va_list ap) {
break;
m_lock.enter();
+ if (m_detailledLogs) {
+ struct ev_loop * loop = ev_default_loop(0);
+ ev_now_update(loop);
+ ev_tstamp now = ev_now(loop);
+ _print("[%15.8f:%08x] ", now, pthread_self());
+ }
_print(prefixes[i]);
_print(fmt, ap);
_print("\n");