X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FIOStreamTarget.hh;h=229ab6309c4614537327adbf81aa4bb8d2880c6b;hb=41eff772147b6df1961d9029ba6815b553b4f81d;hp=94f999948c2f7a3e0440db9592e1112306d4273f;hpb=ae06fe86f16fdabb7ffb219d255444d2eb4f4f79;p=senf.git diff --git a/Utils/Logger/IOStreamTarget.hh b/Utils/Logger/IOStreamTarget.hh index 94f9999..229ab63 100644 --- a/Utils/Logger/IOStreamTarget.hh +++ b/Utils/Logger/IOStreamTarget.hh @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer NETwork research (NET) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -23,13 +23,14 @@ /** \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 #include #include "Target.hh" +#include "LogFormat.hh" //#include "IOStreamTarget.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -37,54 +38,51 @@ namespace senf { namespace log { - /** \brief Write log messages to arbitrary std::ostream + /** \brief Write %log messages to arbitrary std::ostream - This target will write log messages to an arbitrary std::ostream in the format -
-         [] 
-        
- - 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. + This target will write %log messages to an arbitrary std::ostream in the format + \verbatim [][] \endverbatim + The \e area will be omitted if it is \c senf::log::DefaultArea. + \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. + \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: - - private: - void v_write(boost::posix_time::ptime timestamp, std::string const & stream, + void v_write(time_type timestamp, std::string const & stream, std::string const & area, unsigned level, std::string const & message); + private: std::ostream & stream_; - }; + }; }} ///////////////////////////////hh.e//////////////////////////////////////// -//#include "IOStreamTarget.cci" +#include "IOStreamTarget.cci" //#include "IOStreamTarget.ct" //#include "IOStreamTarget.cti" #endif