title: In Boost Log, how do I format a custom severity_level using a format string?
body: <p>I'm using boost log in my C++ program, and I have a custom <code>severity_logger&lt; severity_level &gt;</code> using a severity_level enum that I defined. Then I create my log sink with the format string <code>"%TimeStamp% [%ThreadID%] %Severity% %Module% - %Message%"</code> but it doesn't display the severity where I have <code>%Severity%</code> but instead is just blank in that position. For example, <code>2013-07-29 10:31 [0xDEADBEEF]  my.Module - Hello World</code>. What do I need to do in my format string to make it display the severity level?</p>
  
  <p>Here's a portion of my code:</p>
  
  <pre><code>#define NUM_SEVERITY_LEVELS 6
  enum severity_level
  { 
    // These are deliberately the same levels that log4j uses
    trace = 0,
    debug = 1,
    info = 2,
    warning = 3,
    error = 4,                  
    fatal = 5                   
  };  
  
  typedef src::severity_logger&lt; severity_level &gt; logger_t;
  
  const char* severity_level_str[NUM_SEVERITY_LEVELS] = {
    "TRACE",
    "DEBUG",
    "INFO",
    "WARNING",
    "ERROR",
    "FATAL" 
  };
  
  template&lt; typename CharT, typename TraitsT &gt;
  std::basic_ostream&lt; CharT, TraitsT &gt;&amp;
  operator&lt;&lt; (
    std::basic_ostream&lt; CharT, TraitsT &gt;&amp; strm,
    severity_level lvl
  )
  {
      const char* str = severity_level_str[lvl];
      if (lvl &lt; NUM_SEVERITY_LEVELS &amp;&amp; lvl &gt;= 0)
          strm &lt;&lt; str;
      else
          strm &lt;&lt; static_cast&lt; int &gt;(lvl);
      return strm;
  }
  
  #define FORMAT_STRING "%TimeStamp% [%ThreadID%] %Severity% %Module% - %Message%"
  
  boost::shared_ptr&lt; sinks::synchronous_sink&lt; sinks::text_file_backend &gt; &gt;
  LOG_CREATE_SINK(const std::string&amp; strLogFilename, bool fAutoFlush)
  { 
    return logging::add_file_log(
      keywords::file_name = strLogFilename,
      keywords::open_mode = (std::ios_base::app | std::ios_base::out) &amp; ~std::ios_base::in,
      keywords::auto_flush = fAutoFlush,
      keywords::format = FORMAT_STRING );
  }
  </code></pre>