c++.stlsoft - Function name as part of message (pantheios)
- Lars Ivar Igesund (5/5) Mar 13 2008 Does Pantheios provide a configuration that yields a logged message cont...
- Matthew Wilson (8/13) Mar 13 2008 Yes indeed.
- Lars Ivar Igesund (8/28) Mar 13 2008 I am probably blind, but this provides the filename and line number inst...
- Matthew Wilson (11/39) Mar 14 2008 Gah! Sorry
- Matthew Wilson (26/69) Mar 14 2008 Here we go:
Does Pantheios provide a configuration that yields a logged message containing the containing function? Aka log(informational, __FUNCTION__, ": my message"); just without having to write that (or some wrapper like XTESTS_GET_FUNCTION that checks for compiler support). Lars Ivar
Mar 13 2008
Yes indeed. Check out the Pantheios Tracing API, defined in include/pantheios/trace.h, and the example in examples/cpp/example.cpp.tracing/example.cpp.tracing.cpp Matt "Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:frb88h$1d2n$1 digitalmars.com...Does Pantheios provide a configuration that yields a logged messagecontaining the containing function?Aka log(informational, __FUNCTION__, ": my message"); just without having to write that (or some wrapper likeXTESTS_GET_FUNCTION that checks for compiler support).Lars Ivar
Mar 13 2008
Matthew Wilson wrote:Yes indeed. Check out the Pantheios Tracing API, defined in include/pantheios/trace.h, and the example in examples/cpp/example.cpp.tracing/example.cpp.tracing.cppI am probably blind, but this provides the filename and line number instead of function name?Matt "Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:frb88h$1d2n$1 digitalmars.com...-- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the TangoDoes Pantheios provide a configuration that yields a logged messagecontaining the containing function?Aka log(informational, __FUNCTION__, ": my message"); just without having to write that (or some wrapper likeXTESTS_GET_FUNCTION that checks for compiler support).Lars Ivar
Mar 13 2008
Gah! Sorry It was part of the original design to do this, and I answered your email at an unBobbly hour. I will attend to this and illustrate the way to use it to achieve what you want in a couple of hours. Cheers Matt "Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:frc8bc$1fmo$1 digitalmars.com...Matthew Wilson wrote:include/pantheios/trace.h,Yes indeed. Check out the Pantheios Tracing API, defined ininsteadand the example in examples/cpp/example.cpp.tracing/example.cpp.tracing.cppI am probably blind, but this provides the filename and line numberof function name?Matt "Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:frb88h$1d2n$1 digitalmars.com...-- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the TangoDoes Pantheios provide a configuration that yields a logged messagecontaining the containing function?Aka log(informational, __FUNCTION__, ": my message"); just without having to write that (or some wrapper likeXTESTS_GET_FUNCTION that checks for compiler support).Lars Ivar
Mar 14 2008
Here we go: You just need to #define PANTHEIOS_TRACE_PREFIX to what you want. By default it is __FILE__ "(" PANTHEIOS_STRINGIZE(__LINE__) "): " (ie. "<file>(<line>): ") For function, lets says you want it to be (ie. "<file>(<line>): <func>: "). In that case you'd define it as follows: #include <pantheios/pantheios.h> #define PANTHEIOS_TRACE_PREFIX __FILE__ " " PANTHEIOS_STRINGIZE(__LINE__) ": " __FUNCTION__ ": " #include <pantheios/trace.h> Note that the definition *must* come before the inclusion of pantheios/trace.h. Therefore, a safer way of doing this is as follows: /* File: myPantheiosRootHeader.h */ #include <pantheios/pantheios.h> #ifdef PANTHEIOS_INCL_PANTHEIOS_H_TRACE myPantheiosRootHeader.h #endif /* PANTHEIOS_INCL_PANTHEIOS_H_TRACE */ #define PANTHEIOS_TRACE_PREFIX __FILE__ " " PANTHEIOS_STRINGIZE(__LINE__) ": " __FUNCTION__ ": " #include <pantheios/trace.h> HTH Matt "Matthew Wilson" <matthew hat.stlsoft.dot.org> wrote in message news:frdfq5$1s07$1 digitalmars.com...Gah! Sorry It was part of the original design to do this, and I answered your emailatan unBobbly hour. I will attend to this and illustrate the way to use it to achieve what you want in a couple of hours. Cheers Matt "Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:frc8bc$1fmo$1 digitalmars.com...Matthew Wilson wrote:include/pantheios/trace.h,Yes indeed. Check out the Pantheios Tracing API, defined ininsteadand the example in examples/cpp/example.cpp.tracing/example.cpp.tracing.cppI am probably blind, but this provides the filename and line numberof function name?Matt "Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:frb88h$1d2n$1 digitalmars.com...-- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the TangoDoes Pantheios provide a configuration that yields a logged messagecontaining the containing function?Aka log(informational, __FUNCTION__, ": my message"); just without having to write that (or some wrapper likeXTESTS_GET_FUNCTION that checks for compiler support).Lars Ivar
Mar 14 2008