// $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 <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// Custom includes
#include <locale>
+#include <boost/algorithm/string/trim.hpp>
+#include <boost/tokenizer.hpp>
//#include "IOStreamTarget.mpp"
#define prefix_
{
std::locale const & loc (stream_.getloc());
if (!std::has_facet<boost::posix_time::time_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")) );
}
////////////////////////////////////////
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<char> Separator;
+ typedef boost::tokenizer<Separator> 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////////////////////////////////////////