title: Boost Log 2.0 : empty Severity level in logs
body: <p>I'm using Boost-Log 2.0, which has some differences from version 1, and I have a hard time outputting the "Severity" attribute.</p>
  
  <p>I'm using the "Boost.Format-style" formatters </p>
  
  <pre><code>"%TimeStamp% [%Uptime%] (%LineID%) &lt;%Severity%&gt;: %Message%"
  </code></pre>
  
  <p><code>TimeStamp</code>, <code>LineID</code>, and <code>Message</code> are <code>common_attributes</code>. <code>Uptime</code> is an attribute I added using <code>attrs::timer()</code>. I thought that <code>Severity</code> was automatically added when using <code>severity_logger</code>, but apparently it isn't and that's my problem. I get empty severities, eg:</p>
  
  <pre><code>2013-Apr-06 19:21:52.408974 [00:00:00.001337] (3) &lt;&gt;: A warning severity message
  </code></pre>
  
  <p>Notice the empty <code>&lt;&gt;</code>. I've tried to add severity using <code>register_simple_formatter_factory</code> but then I get the compiler error :</p>
  
  <pre><code>error: no matching function for call to ‘register_simple_formatter_factory(const char [9])’
  </code></pre>
  
  <p>and I don't get why.</p>
  
  <p>Here's my code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  
  #include &lt;boost/log/common.hpp&gt;
  #include &lt;boost/log/core.hpp&gt;
  #include &lt;boost/log/trivial.hpp&gt;
  #include &lt;boost/log/expressions.hpp&gt;
  #include &lt;boost/log/sinks/text_file_backend.hpp&gt;
  #include &lt;boost/log/sinks/sync_frontend.hpp&gt;
  #include &lt;boost/log/sinks/text_ostream_backend.hpp&gt;
  #include &lt;boost/log/utility/setup/file.hpp&gt;
  #include &lt;boost/log/utility/setup/common_attributes.hpp&gt;
  #include &lt;boost/log/utility/setup/formatter_parser.hpp&gt;
  #include &lt;boost/log/sources/severity_logger.hpp&gt;
  #include &lt;boost/log/sources/severity_feature.hpp&gt;
  #include &lt;boost/log/sources/record_ostream.hpp&gt;
  
  #include &lt;boost/log/attributes.hpp&gt;
  
  using namespace std;
  
  namespace logging = boost::log;
  namespace expr = boost::log::expressions;
  namespace attrs = boost::log::attributes;
  namespace src = boost::log::sources;
  namespace keywords = boost::log::keywords;
  
  enum severity_level
  {
      DEBUG,
      INFO,
      WARNING,
      ERROR,
      CRITICAL
  };
  
  BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger, src::severity_logger_mt&lt; severity_level&gt; )
  
  // The formatting logic for the severity level
  template&lt; typename CharT, typename TraitsT &gt;
  inline std::basic_ostream&lt; CharT, TraitsT &gt;&amp; operator&lt;&lt; (
      std::basic_ostream&lt; CharT, TraitsT &gt;&amp; strm, severity_level lvl)
  {
      static const char* const str[] =
      {
          "DEBUG",
          "INFO",
          "WARNING",
          "ERROR",
          "CRITICAL"
      };
      if (static_cast&lt; std::size_t &gt;(lvl) &lt; (sizeof(str) / sizeof(*str)))
          strm &lt;&lt; str[lvl];
      else
          strm &lt;&lt; static_cast&lt; int &gt;(lvl);
      return strm;
  }
  
  void init() {
      // logging::register_simple_formatter_factory&lt; severity_level &gt;("Severity");
      logging::add_file_log(
              keywords::file_name = "blop.log",
              keywords::auto_flush = true,
              keywords::open_mode = (std::ios::out | std::ios::app),
              keywords::format = "%TimeStamp% [%Uptime%] (%LineID%) &lt;%Severity%&gt;: %Message%"
              );
      logging::add_common_attributes();
      logging::core::get()-&gt;add_global_attribute("Uptime", attrs::timer());
  }
  
  int main(int argc, const char *argv[]) {
      init();
      src::severity_logger_mt&lt; severity_level &gt; lg = my_logger::get();
      BOOST_LOG_SEV(lg, DEBUG) &lt;&lt; "A debug severity message";
      BOOST_LOG_SEV(lg, INFO) &lt;&lt; "An informational severity message";
      BOOST_LOG_SEV(lg, WARNING) &lt;&lt; "A warning severity message";
      BOOST_LOG_SEV(lg, ERROR) &lt;&lt; "An error severity message";
      BOOST_LOG_SEV(lg, CRITICAL) &lt;&lt; "A critical severity message";
      return 0;
  }
  </code></pre>
  
  <p>Notice the commented-out line :</p>
  
  <pre><code>// logging::register_simple_formatter_factory&lt; severity_level &gt;("Severity");
  </code></pre>
  
  <p>which produces the mentioned error.</p>
  
  <p>I compile it with:</p>
  
  <pre><code>g++ main.cpp -Wall -DBOOST_ALL_DYN_LINK  -lboost_system -lboost_log_setup -lboost_log -lboost_filesystem -lboost_date_time -lboost_thread -o main
  </code></pre>