4 #ifndef DUNE_PDELAB_COMMON_LOGTAG_HH 5 #define DUNE_PDELAB_COMMON_LOGTAG_HH 29 extern std::ostream &
logtag(std::ostream &
s);
71 virtual void writeTag(std::ostream &
s)
const = 0;
75 template<
class FormatFunc>
79 FormatFunc formatFunc;
88 formatFunc(formatFunc_)
94 virtual void writeTag(std::ostream &
s)
const { formatFunc(s); }
97 template<
class FormatFunc>
98 std::shared_ptr<LogtagFormatterBase>
100 {
return std::make_shared<GeneralLogtagFormatter<FormatFunc> >(formatFunc); }
102 extern std::shared_ptr<LogtagFormatterBase>
114 = std::shared_ptr<LogtagFormatterBase>());
120 template<
class FormatFunc>
142 std::shared_ptr<LogtagFormatterBase> savedFormatter;
145 template<
class FormatFunc>
147 savedFormatter(getLogtagFormatter())
185 inline const std::string &
str()
const {
return str_; }
204 #endif // DUNE_PDELAB_COMMON_LOGTAG_HH const std::shared_ptr< LogtagFormatterBase > & getLogtagFormatter()
get the log tag formatter currently used by logtag()
Definition: logtag.cc:48
const std::string & str() const
extract the static boilerplate message
Definition: logtag.hh:185
const std::string s
Definition: function.hh:830
LocalTag & operator<<(const V &v)
append something to the static boilerplate message
Definition: logtag.hh:189
GeneralLogtagFormatter(const FormatFunc &formatFunc_)
constructor
Definition: logtag.hh:87
std::ostream & operator<<(std::ostream &s, const TimeSpec &t)
insert a timespec into an output stream
Definition: clock.cc:39
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 & hostRankWallUserLogtagFormatFunc(std::ostream &s)
logtag format function that includes hostname, rank (if available), wall time and CPU time ...
Definition: logtag.cc:181
virtual void writeTag(std::ostream &s) const =0
function that writes the tag to a stream
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
std::ostream & logtag(std::ostream &s)
function that writes a log tag to some stream
Definition: logtag.cc:59
void logtagSetupMPI(bool syncWidthes)
collect MPI information for the logtag formatters
Definition: logtag.cc:90
Insert standard boilerplate into log messages.
Definition: logtag.hh:180
void setLogtagRank(int rank)
set the rank to be printed by logtag formatters
virtual base class for logger formatters
Definition: logtag.hh:64
void setLogtagFormatFunc(const FormatFunc &formatFunc)
set a new log tag format function to be used by logtag()
Definition: logtag.hh:121
temporarily use a different log tag format function
Definition: logtag.hh:141
std::shared_ptr< LogtagFormatterBase > makeGeneralLogtagFormatter(std::ostream &(&formatFunc)(std::ostream &))
Convenience function to create a GeneralLogtagFormatter.
Definition: logtag.cc:32
std::ostream & hostPidWallUserLogtagFormatFunc(std::ostream &s)
logtag format function that includes host name, pid, wall time and CPU time
Definition: logtag.cc:194
std::ostream & nullFormatFunc(std::ostream &s)
logtag format function that does not write anything
Definition: logtag.cc:204
A log tag formatter that wraps a unary formatting function or functor.
Definition: logtag.hh:76
WithLogtag(const FormatFunc &formatFunc)
Definition: logtag.hh:146
virtual void writeTag(std::ostream &s) const
write the tag to the stream
Definition: logtag.hh:94