
On Wed, 20 Aug 2008 18:38:31 +0200, Andrey Semashev <andrey.semashev@gmail.com> wrote:
Boris wrote:
Currently I'm writing messages to a file with:
BOOST_LOG(mylogger) << __FUNCSIG__ << " message text";
I'd prefer if the function signature (let's assume for now that the macro is supported by all compilers) is written automatically without me having to add __FUNCSIG__ everywhere. From what I understand I can't simply add an attribute to the logger as __FUNCSIG__ would then be used in another function (and thus a different function signature would be written).
Maybe this is what you seek:
All you have to do is to add a global named scope attribute and the appropriate formatter:
Then you can add BOOST_LOG_FUNCTION and BOOST_LOG_NAMED_SCOPE macros to markup the scopes and you will have the scope stack in the log with each log record you make from within these scopes.
Great, exactly what I've been looking for! I had skipped named scopes before as I had thought it's something esoteric. :) However when I use BOOST_LOG_FUNCTION() I get a compiler error "'BOOST_LOG_NO_UNUSED_WARNINGS': identifier not found". Do I need to include another header file for BOOST_LOG_NO_UNUSED_WARNINGS to be defined? Boris
[...]