// $Id$
//
// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// 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
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/fold.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/utility.hpp>
+#include <boost/type_traits/is_convertible.hpp>
#include "../mpl.hh"
#include "Config.hh"
+#include "Target.hh"
///////////////////////////////ih.p////////////////////////////////////////
-#ifndef _senf_LOG_STREAM
-# define _senf_LOG_STREAM std::cerr
-#endif
-
namespace senf {
namespace log {
senf::mpl::rv<2> Parameters_select_(AreaBase *);
template <class Base, class Param>
struct Parameters_<Base,Param,2> : public Base
- { typedef Param area; };
+ { typedef Param area; typedef Param area_base; };
senf::mpl::rv<3> Parameters_select_(LevelBase *);
template <class Base, class Param>
typename boost::disable_if< boost::is_convertible<T*,AliasBase*> >::type * = 0);
template <class Base, class Param>
struct Parameters_<Base,Param,6> : public Base
- { typedef typename Param::SENFLogArea area; };
+ { typedef typename Param::SENFLogArea area; typedef Param area_base; };
#endif
template <class Base>
struct Parameters : public Base
{
- static bool const compile_enabled = senf::log::Enabled<
- typename Base::stream,
- typename Base::area,
- typename Base::level>::value;
+ typedef typename boost::mpl::if_c< Base::level::value == NONE::value,
+ typename Base::stream::defaultLevel,
+ typename Base::level >::type level;
- static bool enabled() { return compile_enabled; }
- static std::ostream & log_stream() { return _senf_LOG_STREAM; }
+ static bool const compileEnabled = senf::log::Enabled<
+ typename Base::stream,
+ typename Base::area_base,
+ level>::value;
+
+ static bool enabled() {
+ return compileEnabled
+ && ( senf::log::detail::TargetRegistry::instance().fallbackRouting() ||
+ Base::area::instance().limit(Base::stream::instance()) <= level::value );
+ }
};
/// Internal: Empty base class