diff --git a/etk/log.cpp b/etk/log.cpp index ef1d6de..b83a726 100644 --- a/etk/log.cpp +++ b/etk/log.cpp @@ -21,7 +21,7 @@ #include #include #define MAX_DEPTH (256) - void etk::log::displayBacktrace(bool _breakAtEnd) { + void etk::log::displayBacktrace(bool _breakAtEnd, int32_t _removeElement) { // retrieve call-stack void * trace[MAX_DEPTH]; int stack_depth = backtrace(trace, MAX_DEPTH); @@ -38,8 +38,11 @@ if(status == 0 && demangled) { symname = demangled; } - TK_WARNING(" " << dlinfo.dli_fname << ": "); - TK_ERROR(" " << symname); + if (_removeElement <= 0) { + TK_WARNING(" " << dlinfo.dli_fname << ": "); + TK_ERROR(" " << symname); + } + _removeElement--; if(NULL != demangled) { free(demangled); } @@ -49,7 +52,7 @@ } } #else - void etk::log::displayBacktrace(bool _breakAtEnd) { + void etk::log::displayBacktrace(bool _breakAtEnd, int32_t _removeElement) { #ifdef DEBUG assert(false); #endif @@ -380,7 +383,7 @@ void etk::log::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* #endif g_lock.unlock(); if (_level == logLevelCritical) { - displayBacktrace(true); + displayBacktrace(true, 2); } } diff --git a/etk/log.h b/etk/log.h index f44f2ee..fdf97c1 100644 --- a/etk/log.h +++ b/etk/log.h @@ -99,7 +99,7 @@ namespace etk { * @brief Display the current backtrace * @param[in] _breakAtEnd assert program when backtrace is printed */ - void displayBacktrace(bool _breakAtEnd = false); + void displayBacktrace(bool _breakAtEnd = false, int32_t _removeElement=0); }; }; #ifdef __class__