From 2cfa20cc4ede1a4591309a172cef8c8cd73615fc Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Sun, 21 Feb 2016 07:58:53 -0600 Subject: [PATCH] Improving the logging, got fed up with color so optionally disable. Backtrace macro used everwhere --- lib/Init.cc | 9 ++------- lib/Log.cc | 13 +++++++++++++ lib/Log.h | 16 +++++++++------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/lib/Init.cc b/lib/Init.cc index 7c08a6f9..0ca08ac8 100644 --- a/lib/Init.cc +++ b/lib/Init.cc @@ -294,6 +294,7 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr) ucontext_t * uc= (ucontext_t *)ptr; struct sigcontext *sc = (struct sigcontext *)&uc->uc_mcontext; printf(" instruction %llx\n",(unsigned long long)sc->rip); + #define REG(A) printf(" %s %lx\n",#A,sc-> A); REG(rdi); @@ -316,13 +317,7 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr) REG(r14); REG(r15); #endif -#ifdef HAVE_EXECINFO_H - int symbols = backtrace (Grid_backtrace_buffer,_NBACKTRACE); - char **strings = backtrace_symbols(Grid_backtrace_buffer,symbols); - for (int i = 0; i < symbols; i++){ - printf ("%s\n", strings[i]); - } -#endif + BACKTRACE(); exit(0); return; }; diff --git a/lib/Log.cc b/lib/Log.cc index f7b4e6b5..b16ac1e7 100644 --- a/lib/Log.cc +++ b/lib/Log.cc @@ -62,6 +62,19 @@ void GridLogConfigure(std::vector &logstreams) GridLogPerformance.Active(0); GridLogIntegrator.Active(0); + int blackAndWhite = 1; + if(blackAndWhite){ + Logger::BLACK = std::string(""); + Logger::RED =Logger::BLACK; + Logger::GREEN =Logger::BLACK; + Logger::YELLOW =Logger::BLACK; + Logger::BLUE =Logger::BLACK; + Logger::PURPLE =Logger::BLACK; + Logger::CYAN =Logger::BLACK; + Logger::WHITE =Logger::BLACK; + Logger::NORMAL =Logger::BLACK; + } + for(int i=0;i