libmoost
|
handles verbose with log4cxx gracefully. scoped_logger takes care of collecting the log information within the scope, then spit it out (to whatever it was configured to) More...
#include <scoped_logger.hpp>
Classes | |
struct | sLogEntry |
Public Member Functions | |
scoped_logger () | |
scoped_logger (const std::string &name) | |
scoped_logger (const std::string &name, moost::timer::scoped_time &sc) | |
scoped_logger (const std::string &name, moost::multi_timer::scoped_time &sc) | |
scoped_logger (const std::string &name, const boost::posix_time::ptime &startTime) | |
~scoped_logger () | |
void | setTimingsHeader (const std::string &totTimingsHeader=" Overall time: ", const std::string &subTimingsIndentation=" -> ") |
void | addSubTime (const std::string &header, int ms) |
void | forcedLog (const log4cxx::LevelPtr &level, const std::string &message) |
void | forcedLog (const log4cxx::LevelPtr &level, const std::string &message, const log4cxx::spi::LocationInfo &location) |
log4cxx::LevelPtr | getLevel () const |
virtual void | setLevel (const log4cxx::LevelPtr &level) |
void | debug (const std::string &msg, const log4cxx::spi::LocationInfo &location) |
void | debug (const std::string &msg) |
void | error (const std::string &msg, const log4cxx::spi::LocationInfo &location) |
void | error (const std::string &msg) |
void | fatal (const std::string &msg, const log4cxx::spi::LocationInfo &location) |
void | fatal (const std::string &msg) |
void | info (const std::string &msg, const log4cxx::spi::LocationInfo &location) |
void | info (const std::string &msg) |
void | log (const log4cxx::LevelPtr &level, const std::string &message, const log4cxx::spi::LocationInfo &location) |
void | log (const log4cxx::LevelPtr &level, const std::string &message) |
void | warn (const std::string &msg, const log4cxx::spi::LocationInfo &location) |
void | warn (const std::string &msg) |
void | trace (const std::string &msg, const log4cxx::spi::LocationInfo &location) |
void | trace (const std::string &msg) |
void | addRef () const |
void | releaseRef () const |
virtual void | addAppender (const log4cxx::AppenderPtr &) |
void | callAppenders (const log4cxx::spi::LoggingEventPtr &, log4cxx::helpers::Pool &) const |
void | closeNestedAppenders () |
bool | getAdditivity () const |
virtual const log4cxx::LevelPtr & | getEffectiveLevel () const |
log4cxx::spi::LoggerRepositoryPtr | getLoggerRepository () const |
void | getName (std::string &name) const |
log4cxx::LoggerPtr | getParent () const |
log4cxx::helpers::ResourceBundlePtr | getResourceBundle () const |
void | removeAllAppenders () |
void | removeAppender (const log4cxx::AppenderPtr &appender) |
void | setAdditivity (bool additive) |
void | setResourceBundle (const log4cxx::helpers::ResourceBundlePtr &bundle) |
const log4cxx::helpers::Mutex & | getMutex () const |
bool | isAttached (const log4cxx::AppenderPtr &appender) const |
bool | isEnabledFor (const log4cxx::LevelPtr &level) const |
bool | isDebugEnabled () const |
bool | isInfoEnabled () const |
bool | isWarnEnabled () const |
bool | isErrorEnabled () const |
bool | isFatalEnabled () const |
bool | isTraceEnabled () const |
void | init (const std::string &name, log4cxx::LevelPtr level=log4cxx::Level::getFatal()) |
Private Member Functions | |
void | forcedLog () |
void | updateHighestLevel (const log4cxx::LevelPtr &level) |
Private Attributes | |
log4cxx::LevelPtr | m_loggerLevel |
log4cxx::LevelPtr | m_highestMessageLevel |
log4cxx::LogString | m_name |
std::vector< sLogEntry > | m_messages |
std::vector< std::pair < log4cxx::LevelPtr, log4cxx::AppenderPtr > > | m_appenders |
boost::posix_time::ptime | m_startTime |
std::map< std::string, int > | m_subTimes |
std::string | m_totTimingsHeader |
std::string | m_subTimingsIndentation |
handles verbose with log4cxx gracefully. scoped_logger takes care of collecting the log information within the scope, then spit it out (to whatever it was configured to)
Definition at line 67 of file scoped_logger.hpp.
moost::logging::scoped_logger::scoped_logger | ( | ) | [inline] |
moost::logging::scoped_logger::scoped_logger | ( | const std::string & | name | ) | [inline] |
moost::logging::scoped_logger::scoped_logger | ( | const std::string & | name, |
moost::timer::scoped_time & | sc | ||
) | [inline] |
moost::logging::scoped_logger::scoped_logger | ( | const std::string & | name, |
moost::multi_timer::scoped_time & | sc | ||
) | [inline] |
moost::logging::scoped_logger::scoped_logger | ( | const std::string & | name, |
const boost::posix_time::ptime & | startTime | ||
) | [inline] |
moost::logging::scoped_logger::~scoped_logger | ( | ) | [inline] |
virtual void moost::logging::scoped_logger::addAppender | ( | const log4cxx::AppenderPtr & | ) | [inline, virtual] |
Definition at line 269 of file scoped_logger.hpp.
void moost::logging::scoped_logger::addRef | ( | ) | const [inline] |
Definition at line 265 of file scoped_logger.hpp.
void moost::logging::scoped_logger::addSubTime | ( | const std::string & | header, |
int | ms | ||
) | [inline] |
Definition at line 135 of file scoped_logger.hpp.
void moost::logging::scoped_logger::callAppenders | ( | const log4cxx::spi::LoggingEventPtr & | , |
log4cxx::helpers::Pool & | |||
) | const [inline] |
Definition at line 271 of file scoped_logger.hpp.
void moost::logging::scoped_logger::closeNestedAppenders | ( | ) | [inline] |
Definition at line 273 of file scoped_logger.hpp.
void moost::logging::scoped_logger::debug | ( | const std::string & | msg, |
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::debug | ( | const std::string & | msg | ) | [inline] |
void moost::logging::scoped_logger::error | ( | const std::string & | msg, |
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::error | ( | const std::string & | msg | ) | [inline] |
void moost::logging::scoped_logger::fatal | ( | const std::string & | msg, |
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::fatal | ( | const std::string & | msg | ) | [inline] |
void moost::logging::scoped_logger::forcedLog | ( | const log4cxx::LevelPtr & | level, |
const std::string & | message | ||
) | [inline] |
void moost::logging::scoped_logger::forcedLog | ( | const log4cxx::LevelPtr & | level, |
const std::string & | message, | ||
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::forcedLog | ( | ) | [inline, private] |
Definition at line 343 of file scoped_logger.hpp.
bool moost::logging::scoped_logger::getAdditivity | ( | ) | const [inline] |
Definition at line 276 of file scoped_logger.hpp.
virtual const log4cxx::LevelPtr& moost::logging::scoped_logger::getEffectiveLevel | ( | ) | const [inline, virtual] |
Definition at line 280 of file scoped_logger.hpp.
log4cxx::LevelPtr moost::logging::scoped_logger::getLevel | ( | ) | const [inline] |
Definition at line 163 of file scoped_logger.hpp.
log4cxx::spi::LoggerRepositoryPtr moost::logging::scoped_logger::getLoggerRepository | ( | ) | const [inline] |
Definition at line 282 of file scoped_logger.hpp.
const log4cxx::helpers::Mutex& moost::logging::scoped_logger::getMutex | ( | ) | const [inline] |
Definition at line 299 of file scoped_logger.hpp.
void moost::logging::scoped_logger::getName | ( | std::string & | name | ) | const [inline] |
Definition at line 284 of file scoped_logger.hpp.
log4cxx::LoggerPtr moost::logging::scoped_logger::getParent | ( | ) | const [inline] |
Definition at line 286 of file scoped_logger.hpp.
log4cxx::helpers::ResourceBundlePtr moost::logging::scoped_logger::getResourceBundle | ( | ) | const [inline] |
Definition at line 288 of file scoped_logger.hpp.
void moost::logging::scoped_logger::info | ( | const std::string & | msg, |
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::info | ( | const std::string & | msg | ) | [inline] |
void moost::logging::scoped_logger::init | ( | const std::string & | name, |
log4cxx::LevelPtr | level = log4cxx::Level::getFatal() |
||
) | [inline] |
Initialize the logger. It will go through all the appenders currently registered and check the lowest threshold, then set its own level to that and keep track of the appenders.
Definition at line 443 of file scoped_logger.hpp.
bool moost::logging::scoped_logger::isAttached | ( | const log4cxx::AppenderPtr & | appender | ) | const [inline] |
Definition at line 305 of file scoped_logger.hpp.
bool moost::logging::scoped_logger::isDebugEnabled | ( | ) | const [inline] |
bool moost::logging::scoped_logger::isEnabledFor | ( | const log4cxx::LevelPtr & | level | ) | const [inline] |
bool moost::logging::scoped_logger::isErrorEnabled | ( | ) | const [inline] |
bool moost::logging::scoped_logger::isFatalEnabled | ( | ) | const [inline] |
bool moost::logging::scoped_logger::isInfoEnabled | ( | ) | const [inline] |
bool moost::logging::scoped_logger::isTraceEnabled | ( | ) | const [inline] |
bool moost::logging::scoped_logger::isWarnEnabled | ( | ) | const [inline] |
void moost::logging::scoped_logger::log | ( | const log4cxx::LevelPtr & | level, |
const std::string & | message, | ||
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::log | ( | const log4cxx::LevelPtr & | level, |
const std::string & | message | ||
) | [inline] |
void moost::logging::scoped_logger::releaseRef | ( | ) | const [inline] |
Definition at line 267 of file scoped_logger.hpp.
void moost::logging::scoped_logger::removeAllAppenders | ( | ) | [inline] |
Definition at line 291 of file scoped_logger.hpp.
void moost::logging::scoped_logger::removeAppender | ( | const log4cxx::AppenderPtr & | appender | ) | [inline] |
Definition at line 293 of file scoped_logger.hpp.
void moost::logging::scoped_logger::setAdditivity | ( | bool | additive | ) | [inline] |
Definition at line 295 of file scoped_logger.hpp.
virtual void moost::logging::scoped_logger::setLevel | ( | const log4cxx::LevelPtr & | level | ) | [inline, virtual] |
Definition at line 166 of file scoped_logger.hpp.
void moost::logging::scoped_logger::setResourceBundle | ( | const log4cxx::helpers::ResourceBundlePtr & | bundle | ) | [inline] |
Definition at line 297 of file scoped_logger.hpp.
void moost::logging::scoped_logger::setTimingsHeader | ( | const std::string & | totTimingsHeader = " Overall time: " , |
const std::string & | subTimingsIndentation = " -> " |
||
) | [inline] |
Set the timings headers.
Definition at line 129 of file scoped_logger.hpp.
void moost::logging::scoped_logger::trace | ( | const std::string & | msg, |
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::trace | ( | const std::string & | msg | ) | [inline] |
void moost::logging::scoped_logger::updateHighestLevel | ( | const log4cxx::LevelPtr & | level | ) | [inline, private] |
void moost::logging::scoped_logger::warn | ( | const std::string & | msg, |
const log4cxx::spi::LocationInfo & | location | ||
) | [inline] |
void moost::logging::scoped_logger::warn | ( | const std::string & | msg | ) | [inline] |
std::vector< std::pair<log4cxx::LevelPtr, log4cxx::AppenderPtr> > moost::logging::scoped_logger::m_appenders [private] |
The list of available appenders.
Definition at line 508 of file scoped_logger.hpp.
log4cxx::LevelPtr moost::logging::scoped_logger::m_highestMessageLevel [private] |
The highest level of the message received. It's used when sending the actual entry to the appender.
Definition at line 493 of file scoped_logger.hpp.
log4cxx::LevelPtr moost::logging::scoped_logger::m_loggerLevel [private] |
The level of the logger. Below this level nothing is stored. This is generally initialized with the smallest level of all the appenders attached to root.
Definition at line 487 of file scoped_logger.hpp.
std::vector<sLogEntry> moost::logging::scoped_logger::m_messages [private] |
The messages stored.
Definition at line 503 of file scoped_logger.hpp.
log4cxx::LogString moost::logging::scoped_logger::m_name [private] |
The name of the log.
Definition at line 498 of file scoped_logger.hpp.
boost::posix_time::ptime moost::logging::scoped_logger::m_startTime [private] |
Definition at line 510 of file scoped_logger.hpp.
std::map<std::string, int> moost::logging::scoped_logger::m_subTimes [private] |
Definition at line 511 of file scoped_logger.hpp.
std::string moost::logging::scoped_logger::m_subTimingsIndentation [private] |
Definition at line 514 of file scoped_logger.hpp.
std::string moost::logging::scoped_logger::m_totTimingsHeader [private] |
Definition at line 513 of file scoped_logger.hpp.