X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FIOStreamTarget.cc;h=f5e3a6faa73208d3952b35da97080ceeb58cb5f1;hb=012a592d56be453719b7fbba492b56ae804c048f;hp=f70fdd770119f0ff1f5da872c1665baea4a137f2;hpb=ae06fe86f16fdabb7ffb219d255444d2eb4f4f79;p=senf.git diff --git a/Utils/Logger/IOStreamTarget.cc b/Utils/Logger/IOStreamTarget.cc index f70fdd7..f5e3a6f 100644 --- a/Utils/Logger/IOStreamTarget.cc +++ b/Utils/Logger/IOStreamTarget.cc @@ -28,6 +28,8 @@ // Custom includes #include +#include +#include //#include "IOStreamTarget.mpp" #define prefix_ @@ -41,7 +43,8 @@ prefix_ senf::log::IOStreamTarget::IOStreamTarget(std::ostream & os) { std::locale const & loc (stream_.getloc()); if (!std::has_facet(loc)) - stream_.imbue( std::locale(loc, new boost::posix_time::time_facet("%Y-%m-%d %H:%M:%S.%f-0000")) ); + stream_.imbue( std::locale( + loc, new boost::posix_time::time_facet("%Y-%m-%d %H:%M:%S.%f-0000")) ); } //////////////////////////////////////// @@ -52,10 +55,25 @@ prefix_ void senf::log::IOStreamTarget::v_write(boost::posix_time::ptime timesta std::string const & area, unsigned level, std::string const & message) { - stream_ << timestamp << " "; - if (! area.empty()) - stream_ << "[" << area << "] "; - stream_ << message << std::endl; + std::string m (boost::trim_right_copy(message)); + + typedef boost::char_separator Separator; + typedef boost::tokenizer Tokenizer; + Separator separator ("\n"); + Tokenizer tokenizer (m, separator); + Tokenizer::iterator i (tokenizer.begin()); + Tokenizer::iterator const i_end (tokenizer.end()); + + char sep (' '); + + for (; i != i_end; ++i) { + stream_ << timestamp << sep; + if (area != "senf::log::DefaultArea") + stream_ << "[" << area << "] "; + stream_ << *i << "\n"; + sep = '-'; + } + stream_ << std::flush; } ///////////////////////////////cc.e////////////////////////////////////////