From 07b2ec5910e103fc38daa55d0fd0e931b66f5626 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 29 Nov 2011 01:20:21 -0800 Subject: Adding detailled logs, with timestamp and threadid. --- src/Printer.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/Printer.cc') 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"); -- cgit v1.2.3