Utils/Logger: Add console directory to target
[senf.git] / Utils / Logger / IOStreamTarget.hh
index 05f9eee..229ab63 100644 (file)
 /** \file
     \brief IOStreamTarget public header */
 
-#ifndef HH_IOStreamTarget_
-#define HH_IOStreamTarget_ 1
+#ifndef HH_SENF_Utils_Logger_IOStreamTarget_
+#define HH_SENF_Utils_Logger_IOStreamTarget_ 1
 
 // Custom includes
 #include <boost/utility.hpp>
 #include <boost/scoped_ptr.hpp>
 #include "Target.hh"
+#include "LogFormat.hh"
 
 //#include "IOStreamTarget.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -44,34 +45,30 @@ namespace log {
 
         The \e area will be omitted if it is \c senf::log::DefaultArea.
         
-        The date formatting is set using the Boost.DateTime date_facet, e.g.:
-        \code
-        stream.imbue( std::locale(stream.getloc(), 
-                                  new boost::posix_time::time_facet("%Y%m%d %H:%M:%S")) );
-        \endcode
-
-        By default, the date-time will be written in extended ISO format.
-
         \warning The class keeps a reference to the passed stream.
         
-        \note This class will permanently and globally change the date formating of the given
-            stream if no \c boost::posix_time::time_facet has been set.
-
         \ingroup targets
       */
     class IOStreamTarget
-        : public Target
+        : public Target, private detail::LogFormat
     {
     public:
         ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
         ///@{
 
-        explicit IOStreamTarget(std::ostream & os);
+        IOStreamTarget(std::string const & name, std::ostream & os);
 
         ///@}
         ///////////////////////////////////////////////////////////////////////////
 
+        using detail::LogFormat::showTime;
+        using detail::LogFormat::showStream;
+        using detail::LogFormat::showLevel;
+        using detail::LogFormat::showArea;
+        using detail::LogFormat::timeFormat;
+        using detail::LogFormat::tag;
+        
     protected:
         void v_write(time_type timestamp, std::string const & stream, 
                      std::string const & area, unsigned level, 
@@ -79,13 +76,13 @@ namespace log {
 
     private:
         std::ostream & stream_;
-        static char const * const LEVELNAMES_[8];
+
     };
 
 }}
 
 ///////////////////////////////hh.e////////////////////////////////////////
-//#include "IOStreamTarget.cci"
+#include "IOStreamTarget.cci"
 //#include "IOStreamTarget.ct"
 //#include "IOStreamTarget.cti"
 #endif