Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Log] More queries
From: Leo Carreon (lcarreon_at_[hidden])
Date: 2013-07-15 09:04:11


From: Colin Powers
Sent: Monday, July 15, 2013 7:27 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Boost.Log] More queries

_____________________________________________
From: Leo Carreon [mailto:lcarreon_at_[hidden]]
Sent: 15 July 2013 10:03
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Boost.Log] More queries

From: Colin Powers
Sent: Monday, July 15, 2013 6:06 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Boost.Log] More queries

_____________________________________________
From: Leo Carreon [mailto:lcarreon_at_[hidden]]
Sent: 14 July 2013 04:04
To: Boost Users Mailing List
Subject: Re: [Boost-users] [Boost.Log] More queries

From: Leo Carreon
Sent: Saturday, July 13, 2013 3:51 PM
To: Boost Users Mailing List
Subject: [Boost.Log] More queries

Hi everyone,

As I have mentioned in a previous post, I have been trying to learn how to use Boost.Log.

I have been experimenting with logging to a file with filtering and specifying the log formatting in three different ways, namely:

1. Specifying the log formatting using a lambda type expression.
2. Specifying the log formatting using a plain text string with placeholders for the attributes that I have defined.
3. Specifying the log formatting in a settings file. (However, the formatting string is exactly the same as in 2 above.)

I have attached a copy of my source code and settings file. Note that I comment out parts of the source code file depending on which option I use above.

The problem I’m encountering is when I use options 2 & 3 above, the severity level string does not appear in the log.
But if I use option 1, the severity level string appears as expected. It is my understanding that severity level is a pre-defined attribute when using a severity_logger.

Am I missing something when using options 2 & 3?

If I decide to use my own severity level enumeration, what do I need to do?

Kind regards,
Leo

Hi again everyone,

I have managed to use my own severity level enumeration but the severity level string is still not appearing in the log.

Regards again,
Leo

Hi Leo,
Again I'm basing this on how it used to work in Logutils 1.1, so apologies if this is out of date.
Try defining a function like the following:
std::ostream& operator<< (std::ostream& Stream, MySeverityLevelEnum Level)
{
    switch(Level)
    {
        case notice:
            Stream << "notice";
            break;
        case debug:
            Stream << "debug";
            break;
    }
    return Stream;
}

So long as this function is visible to Boost.Log it will use it.

Hi Colin,

First of all, thank you for your reply.

However, I already have a similar function. Actually, I’m following the example shown in the documentation under “Detailed Features Description – Lambda Expressions” but it does seem to have the right effect.

Regards,
Leo

Okay - apologies, I didn't actually look at your test code. You may be going more advanced that I did when I played with it.
Looking at my old code the only other things I appear to be doing to set up Severity Level is the following function calls:
boost::log::add_common_attributes(); //not sure if this one is necessary for you
boost::log::register_simple_formatter_factory<MySeverityLevelEnum>("Severity"); //might help
They might be worth a try - if not, I'm afraid you're into an area I haven't yet played with :)
Cheers
Colin
Hi Colin,
Thanks for attempting to give me a hand on this issue.
I tried calling boost::log::register_simple_formatter_factory<>() and it still doesn’t have any effect.
I believe I really need Andrey’s assistance on this one.
Regards,
Leo

________________________________
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

--------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net