Skip to content
Snippets Groups Projects
Commit 294bdbc1 authored by tho's avatar tho
Browse files

IOStreamTarget: added loglevel to output

parent 65a95e0b
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,7 @@ BOOST_AUTO_UNIT_TEST(inet6SocketAddress)
{
INet6SocketAddress addr;
BOOST_CHECK( ! addr );
BOOST_CHECK_EQUAL( boost::lexical_cast<std::string>(addr.address()), "::" );
BOOST_CHECK_EQUAL( addr.port(), 0u );
BOOST_CHECK_EQUAL( addr.iface(), "" );
......
......@@ -38,6 +38,9 @@
///////////////////////////////////////////////////////////////////////////
// senf::log::IOStreamTarget
const char * const senf::log::IOStreamTarget::LEVELNAMES_[8] = {
"NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" };
prefix_ senf::log::IOStreamTarget::IOStreamTarget(std::ostream & os)
: stream_(os)
{
......@@ -69,7 +72,8 @@ prefix_ void senf::log::IOStreamTarget::v_write(boost::posix_time::ptime timesta
for (; i != i_end; ++i) {
stream_ << timestamp << sep;
if (area != "senf::log::DefaultArea")
stream_ << "[" << area << "] ";
stream_ << "[" << area << "]";
stream_ << "[" << LEVELNAMES_[level] << "] ";
stream_ << *i << "\n";
sep = '-';
}
......
......@@ -82,9 +82,9 @@ namespace log {
std::string const & message);
std::ostream & stream_;
static char const * const LEVELNAMES_[8];
};
}}
///////////////////////////////hh.e////////////////////////////////////////
......
......@@ -41,7 +41,7 @@ namespace log {
<dl><dt>VERBOSE</dt><dd>Really verbose %log messages. Messages at this level are used for
internal debugging. They should be enabled only selectively within the areas currently under
inspection. The default log stream senf::log::Debug has these messages <em>disabled</em> at
inspection. The default %log stream senf::log::Debug has these messages <em>disabled</em> at
compile time by default. To enable them, see \ref config.</dd>
<dt>NOTICE</dt><dd>Arbitrary unimportant notice. Message which normally should be disabled
......
......@@ -43,8 +43,8 @@ namespace {
typedef std::string result_type;
std::string operator()(senf::log::Target::RoutingEntry const & entry) const
{
static char const * levels[] = { "NONE", "VERBOSE", "NOTICE", "MESSAGE",
"IMPORTANT", "CRITICAL","DISABLED" };
static char const * levels[] = {
"NONE", "VERBOSE", "NOTICE", "MESSAGE", "IMPORTANT", "CRITICAL", "FATAL", "DISABLED" };
static char const * actions[] = { "ACCEPT", "REJECT" };
std::stringstream s;
s << entry.stream() << "-" << entry.area() << "-" << levels[entry.level()] << "-"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment