dune-pdelab  2.4-dev
Public Member Functions | List of all members
Dune::PDELab::LocalTag Class Reference

Insert standard boilerplate into log messages. More...

#include <dune/pdelab/common/logtag.hh>

Public Member Functions

const std::string & str () const
 extract the static boilerplate message More...
 
template<class V >
LocalTagoperator<< (const V &v)
 append something to the static boilerplate message More...
 

Detailed Description

Insert standard boilerplate into log messages.

This class can be used to create your own logtag locally, e.g. inside a function. When inserted into a std::ostream, it will insert the standard logtag and some static boilerplate string. The boilerplate string can be constructed by inserting into the localtag itself. Sample usage:

void myfunc() {
LocalTag mytag;
mytag << "myfunc(): ";
std::cout << mytag << "Starting..." << std::endl;
for(unsigned stage = 0; stage < 42; ++stage) {
LocalTag stagetag(mytag);
stagetag << "stage " << stage << ": ";
std::cout << stagetag << "Starting... << std::endl;
do_somethin(stage);
std::cout << stagetag << "Finished." << std::endl;
}
std::cout << mytag << "Finished." << std::endl;
}

Member Function Documentation

template<class V >
LocalTag& Dune::PDELab::LocalTag::operator<< ( const V &  v)
inline

append something to the static boilerplate message

References s.

const std::string& Dune::PDELab::LocalTag::str ( ) const
inline

extract the static boilerplate message

Referenced by Dune::PDELab::operator<<().


The documentation for this class was generated from the following file: