From 4f856c328154cd15c14084f69c40440b992a97e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Thu, 14 Apr 2005 19:12:18 +0000 Subject: [PATCH] better formatting for operators --- mrw/autofunctiontracelog4cxx.cpp | 39 ++++++++++++-------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/mrw/autofunctiontracelog4cxx.cpp b/mrw/autofunctiontracelog4cxx.cpp index c061720..e47aa39 100644 --- a/mrw/autofunctiontracelog4cxx.cpp +++ b/mrw/autofunctiontracelog4cxx.cpp @@ -9,6 +9,9 @@ @license LGPL, see file COPYING $Log$ + Revision 1.3 2005/04/14 19:12:18 marc + better formatting for operators + Revision 1.2 2005/04/07 20:42:38 marc renamed loggerhierarchy from mrw.gccfunctiontrace to mrw.fn @@ -108,27 +111,7 @@ extern "C" int main(int, char**); necessary, because otherwise access the incompletely initialized MRW-C++ library itself may cause a crash. - I use the following log4cxx @c log4cxx::PropertyConfigurator - configuration in the test program to enable all function traces, - except from some third party and standard libraries: - - @verbatim -log4j.rootLogger = OFF, A1 -log4j.logger.mrw.fn = DEBUG, A1 -log4j.logger.mrw.fn.log4cxx = OFF, A1 -log4j.logger.mrw.fn.boost = OFF, A1 -log4j.logger.mrw.fn.Thread = OFF, A1 -log4j.logger.mrw.fn.mrw = OFF, A1 -log4j.logger.mrw.fn.std = OFF, A1 -log4j.logger.mrw.fn.new = OFF, A1 -log4j.logger.mrw.fn.CppUnit = OFF, A1 -log4j.logger.mrw.fn.__gnu_cxx = OFF, A1 -log4j.appender.A1 = org.apache.log4j.FileAppender -log4j.appender.A1.layout = org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern = %t-%-41c%m%n -log4j.appender.A1.filename = filename.log - @endverbatim - + A good default configuration is given in @ref AutoInitLog4cxx. Depending on your log4cxx configuration, a function trace may look e.g. like this (very simple configuration with very few additional information): @@ -155,8 +138,10 @@ mrw.fn.anotherFunction / anotherFunction() @note The configurator is not installed automatically. If you want to trace e.g. on the console, you have to call @c log4cxx::BasicConfigurator::configure(); as first statement - in your @c main(). @see @ref AutoInitLog4cxx if you also want to - automatically configure @c log4cxx. + in your @c main(). + + @see @ref AutoInitLog4cxx if you also want to automatically + configure @c log4cxx. @section AutoFunctionTraceThread Multithreading @@ -190,7 +175,9 @@ extern "C" void __cyg_profile_func_enter(void *this_fn, void*) { (p=hierarchy.find("::", p))!=std::string::npos; hierarchy.replace(p, 2, ".")); hierarchy.erase(hierarchy.rfind('(')); - std::string::size_type p(hierarchy.rfind(' ', hierarchy.find('<'))); + std::string::size_type p + (hierarchy.rfind(' ', std::min(hierarchy.find('<'), + hierarchy.find("operator")))); if (p!=std::string::npos) hierarchy.erase(0, p+1); log4cxx::Logger* logger (log4cxx::Logger::getLogger(_T("mrw.fn.")+hierarchy)); @@ -223,7 +210,9 @@ extern "C" void __cyg_profile_func_exit(void *this_fn, void*) { (p=hierarchy.find("::", p))!=std::string::npos; hierarchy.replace(p, 2, ".")); hierarchy.erase(hierarchy.find('(')); - std::string::size_type p(hierarchy.rfind(' ', hierarchy.find('<'))); + std::string::size_type p + (hierarchy.rfind(' ', std::min(hierarchy.find('<'), + hierarchy.find("operator")))); if (p!=std::string::npos) hierarchy.erase(0, p+1); log4cxx::Logger* logger (log4cxx::Logger::getLogger(_T("mrw.fn.")+hierarchy));