Boost.Log - textual format with severity
Hello! I'm new to boost log (like many others, I imagine since it's only a relatively new library). I'm trying to specify a format textually (eg, keywords::format = "blahblah", instead of using a compiled expression). The idea is that the format can be reconfigured easily either through a command line parameter or through the configuration file without needing to recompile. However, it seems that anything specifying %Severity% when using a custom severity_level enum will simply not be output at all. Take the example from libs/log/example/keywords/main.cpp Simply changing line 86 to be: logging::add_console_log(std::clog, keywords::format = "%Severity% %TimeStamp%: %_%"); will exhibit the problem I believe I am trying to resolve. My suspicion is that the core doesn't know about the custom Severity attribute because it hasn't been registered and so is unable to parse %Severity% to any formatter. In contrast, the add_file_log below that does correctly output the severity level because it uses a compiled expression and is therefore able to deduce what needs to be done (am I correct in that assumption)? I seem to be unable to add an attribute to resolve this without rolling my own attribute class. How do I add an attribute or formatter related to the Severity which was declared with BOOST_LOG_ATTRIBUTE_KEYWORD? I think it's worth noting that if I remove the template parameter to severity_logger on line 123 so that it matches thus: src::severity_logger< > slg; It then devolves into a standard int instead of an enum and the output is "correctly" seen -- as an int and not as a human-readable string. While this is okay for now, I would of course want it to be human-readable if possible. This is as it is in the example in libs/log/example/settings_file/main.cpp. Any help would be appreciated. -- This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
participants (1)
-
Keith Bennett