The answer to this is actually in the FAQ file included in the library download. I have a fixed back-loop DLL that has the following header, and I can include the class, function, and line number in the log file.
#include <pantheios/pantheios.hpp> #include <pantheios/frontends/fe.Nh> //#include <pantheios/frontends/fe.simple.h> #ifndef PANTHEIOS_INCL_PANTHEIOS_H_TRACE #define PANTHEIOS_TRACE_PREFIX __FILE__ "(" PANTHEIOS_STRINGIZE(__LINE__) "): " __FUNCTION__ ": " #endif /* PANTHEIOS_INCL_PANTHEIOS_H_TRACE */ #include <pantheios/trace.h> #include <pantheios/inserters.hpp> #include <pantheios/backends/bec.file.h> // be.file header
What happens here is that you must override PANTHEIOS_TRACE_PREFIX before you include trace.h, as I showed above. Other lines of code are included simply to show you where #define is. And sorry for the late reply. If you want, I can publish the download on my blog using a fixed-content DLL project that anyone can use in their solution for simple file-based logging. Leave a comment if you have interest in this project.
Update 2/28/2010 12:53 AM CST: For your reference, a question from the FAQ arises here:
Q9: "Does Pantheios provide a configuration that gives a registered message containing a containing function equivalent to:
log(informational, __FUNCTION__, ": my message");
without having to write this (or some kind of shell that checks for compiler support). "[March 15, 2008]
A9: You need to tell #define PANTHEIOS_TRACE_PREFIX what you need. By default, this is __FILE__ "(" PANTHEIOS_STRINGIZE(__LINE__) "): " , which gives the format <file>(<line>):
To enable this function, let's say you want it to have the format <file>(<line>): <func>: To do this, you define it as follows:
#include <pantheios/pantheios.h> #define PANTHEIOS_TRACE_PREFIX __FILE__ " " PANTHEIOS_STRINGIZE(__LINE__) ": " __FUNCTION__ ": " #include <pantheios/trace.h>
Please note that a determination must be made before including pantheios / trace.h. Therefore, a safer way to do this is as follows:
#include <pantheios/pantheios.h> #ifdef PANTHEIOS_INCL_PANTHEIOS_H_TRACE # error pantheios/trace.h must not be included before myPantheiosRootHeader.h #endif /* PANTHEIOS_INCL_PANTHEIOS_H_TRACE */ #define PANTHEIOS_TRACE_PREFIX __FILE__ " " PANTHEIOS_STRINGIZE(__LINE__) ": " __FUNCTION__ ": " #include <pantheios/trace.h>