_____________________________________________
From: Leo Carreon [
mailto:lcarreon@bigpond.net.au]
Sent: 14 July 2013 04:04
To: Boost Users Mailing List
Subject: Re: [Boost-users] [Boost.Log] More queries
Sent: Saturday, July 13, 2013 3:51 PM
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.