title: Different boost log sinks for every class
body: <p>I am new to boost log. </p>
  
  <p>My algorithm has 4 main steps and I want the logging for every step in one file. So that I have 4 sinks. My idea is that I can change the sink on every step. Is that possible?</p>
  
  <p>At the moment I have my <code>looger.h</code> with a global logger</p>
  
  <pre><code>#ifndef LOGGER_H_
  #define LOGGER_H_
  
  #include &lt;boost/shared_ptr.hpp&gt;
  #include &lt;boost/make_shared.hpp&gt;
  #include &lt;boost/thread/thread.hpp&gt;
  #include &lt;boost/log/core.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/sources/record_ostream.hpp&gt;
  #include &lt;boost/log/support/date_time.hpp&gt;
  #include &lt;boost/log/common.hpp&gt;
  #include &lt;boost/log/expressions.hpp&gt;
  #include &lt;boost/log/attributes.hpp&gt;
  #include &lt;boost/log/sinks.hpp&gt;
  #include &lt;boost/log/sources/logger.hpp&gt;
  #include &lt;boost/log/utility/setup/common_attributes.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;fstream&gt;
  
  namespace logging = boost::log;
  namespace attrs = boost::log::attributes;
  namespace src = boost::log::sources;
  namespace sinks = boost::log::sinks;
  namespace expr = boost::log::expressions;
  namespace keywords = boost::log::keywords;
  
  enum sign_severity_level {
    trace,
    debug,
    info,
    warning,
    error,
    fatal,
    report
  };
  
  void InitLog()
  {
      typedef sinks::synchronous_sink&lt;sinks::text_ostream_backend&gt; TextSink;
  
      // init sink1
      boost::shared_ptr&lt;sinks::text_ostream_backend&gt; backend1 = boost::make_shared&lt;sinks::text_ostream_backend&gt;();
      backend1-&gt;add_stream(boost::shared_ptr&lt;std::ostream&gt;(new std::ofstream("sign.log")));
      backend1-&gt;auto_flush(true);
      boost::shared_ptr&lt;TextSink&gt; sink1(new TextSink(backend1));
      sink1-&gt;set_formatter(
              expr::format("[%1%]&lt;%2%&gt;(%3%): %4%") % expr::format_date_time &lt; boost::posix_time::ptime
                      &gt; ("TimeStamp", "%Y-%m-%d %H:%M:%S") % expr::attr &lt; sign_severity_level &gt; ("Severity") % expr::attr
                      &lt; attrs::current_thread_id::value_type &gt; ("ThreadID") % expr::smessage);
      sink1-&gt;set_filter(expr::attr &lt; sign_severity_level &gt; ("Severity") &gt;= warning);
      logging::core::get()-&gt;add_sink(sink1);
  
      logging::add_common_attributes();
      logging::core::get()-&gt;add_global_attribute("ThreadID", attrs::current_thread_id());
  }
  BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger, src::severity_logger_mt&lt;sign_severity_level&gt;)
  
  
  #endif /* LOGGER_H_ */ 
  </code></pre>
  
  <p>Is it possible to change the sink after every step?</p>