title: POCO logger wrapper
body: <p>POCO::Logger have class called LogStream who implement a ostream for a logger.</p>
  
  <p>Im trying to write a class wrapper to implement a log system for my project.</p>
  
  <p>so far i have this:</p>
  
  <p>the h.</p>
  
  <pre><code>#include "Poco/LogStream.h"
  #include "Poco/Logger.h"
  #include "Poco/FileChannel.h"
  #include "Poco/AutoPtr.h"
  
  using Poco::Logger;
  using Poco::FileChannel;
  using Poco::AutoPtr;
  using Poco::LogStream;
  
  class MyLogger
  {
  public:
      MyLogger();
      Poco::LogStream&amp; operator()();
      ~MyLogger();
  
  private:
      Poco::Logger&amp; m_logger;
   };
  </code></pre>
  
  <p>the cpp</p>
  
  <pre><code>  MyLogger::MyLogger() : m_logger(Poco::Logger::get(APP_NAME))
    {
  /*
   AutoPtr&lt;FileChannel&gt; pChannel(new FileChannel);
   pChannel-&gt;setProperty("path", "c:\\teshss.log");
   pChannel-&gt;setProperty("rotation", "2 K");
   pChannel-&gt;setProperty("archive", "timestamp");
  
   Logger::root().setChannel(pChannel);
   Logger&amp; logger = Logger::get(APP_NAME); // inherits root channel
  */
    }
  
    Poco::LogStream&amp; MyLogger::operator()()
    {
  AutoPtr&lt;FileChannel&gt; pChannel(new FileChannel);
  pChannel-&gt;setProperty("path", "c:\\teshss.log");
  pChannel-&gt;setProperty("rotation", "2 K");
  pChannel-&gt;setProperty("archive", "timestamp");
  
  Logger::root().setChannel(pChannel);
  Logger&amp; logger = Logger::get("");
  LogStream lstr(logger);
  return lstr;
    }
  
    MyLogger::~MyLogger()
    {
    }
  </code></pre>
  
  <p>then on my project, first i generate a instance for MyLogger:</p>
  
  <pre><code>   MyLogger mylog;
  </code></pre>
  
  <p>and inside a function:</p>
  
  <pre><code>   mylog() &lt;&lt; "Hello world" &lt;&lt; std::endl;
  </code></pre>
  
  <p>This code complile and run, but generate an access violation when i try to write a log line.</p>
  
  <p>Honestly, i dont have to much idea about what im doing, I have experience working with C++, but write a wrapper is totally new for me. So I need some help.</p>
  
  <p>thanks.</p>