4 #ifndef DUNE_PDELAB_COMMON_LOGTAG_HH
5 #define DUNE_PDELAB_COMMON_LOGTAG_HH
29 extern std::ostream &
logtag(std::ostream &
s);
78 template<
class FormatFunc>
82 FormatFunc formatFunc;
91 formatFunc(formatFunc_)
97 virtual void writeTag(std::ostream &
s)
const override { formatFunc(
s); }
100 template<
class FormatFunc>
101 std::shared_ptr<LogtagFormatterBase>
103 {
return std::make_shared<GeneralLogtagFormatter<FormatFunc> >(formatFunc); }
105 extern std::shared_ptr<LogtagFormatterBase>
117 = std::shared_ptr<LogtagFormatterBase>());
123 template<
class FormatFunc>
134 std::shared_ptr<LogtagFormatterBase> savedFormatter;
137 template<
class FormatFunc>
177 inline const std::string &
str()
const {
return str_; }
const std::string s
Definition: function.hh:843
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
std::ostream & operator<<(std::ostream &os, const StatisticsResult< T > &result)
Write statistics result to out stream.
Definition: solverstatistics.hh:140
std::ostream & hostRankWallUserLogtagFormatFunc(std::ostream &s)
logtag format function that includes hostname, rank (if available), wall time and CPU time
Definition: logtag.cc:179
void logtagSetupMPI(bool syncWidthes)
collect MPI information for the logtag formatters
Definition: logtag.cc:88
std::ostream & nullFormatFunc(std::ostream &s)
logtag format function that does not write anything
Definition: logtag.cc:202
std::ostream & hostPidWallUserLogtagFormatFunc(std::ostream &s)
logtag format function that includes host name, pid, wall time and CPU time
Definition: logtag.cc:192
void setLogtagFormatter(const std::shared_ptr< LogtagFormatterBase > &formatter)
set a new log tag formatter to be used by logtag()
Definition: logtag.cc:51
std::ostream & logtag(std::ostream &s)
function that writes a log tag to some stream
Definition: logtag.cc:59
const std::shared_ptr< LogtagFormatterBase > & getLogtagFormatter()
get the log tag formatter currently used by logtag()
Definition: logtag.cc:48
std::shared_ptr< LogtagFormatterBase > makeGeneralLogtagFormatter(std::ostream &(&formatFunc)(std::ostream &))
Convenience function to create a GeneralLogtagFormatter.
Definition: logtag.cc:32
void setLogtagFormatFunc(const FormatFunc &formatFunc)
set a new log tag format function to be used by logtag()
Definition: logtag.hh:124
virtual base class for logger formatters
Definition: logtag.hh:64
virtual ~LogtagFormatterBase()=default
virtual void writeTag(std::ostream &s) const =0
function that writes the tag to a stream
A log tag formatter that wraps a unary formatting function or functor.
Definition: logtag.hh:81
virtual void writeTag(std::ostream &s) const override
write the tag to the stream
Definition: logtag.hh:97
GeneralLogtagFormatter(const FormatFunc &formatFunc_)
constructor
Definition: logtag.hh:90
temporarily use a different log tag format function
Definition: logtag.hh:133
~WithLogtag()
Definition: logtag.cc:65
WithLogtag(const FormatFunc &formatFunc)
Definition: logtag.hh:138
Insert standard boilerplate into log messages.
Definition: logtag.hh:172
const std::string & str() const
extract the static boilerplate message
Definition: logtag.hh:177
LocalTag & operator<<(const V &v)
append something to the static boilerplate message
Definition: logtag.hh:181