Go to the documentation of this file.
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 override { 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>
131 std::shared_ptr<LogtagFormatterBase> savedFormatter;
134 template<
class FormatFunc>
174 inline const std::string &
str()
const {
return str_; }
193 #endif // DUNE_PDELAB_COMMON_LOGTAG_HH
void setLogtagFormatFunc(const FormatFunc &formatFunc)
set a new log tag format function to be used by logtag()
Definition: logtag.hh:121
std::ostream & nullFormatFunc(std::ostream &s)
logtag format function that does not write anything
Definition: logtag.cc:202
const std::shared_ptr< LogtagFormatterBase > & getLogtagFormatter()
get the log tag formatter currently used by logtag()
Definition: logtag.cc:48
std::ostream & logtag(std::ostream &s)
function that writes a log tag to some stream
Definition: logtag.cc:59
const std::string & str() const
extract the static boilerplate message
Definition: logtag.hh:174
temporarily use a different log tag format function
Definition: logtag.hh:130
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
virtual base class for logger formatters
Definition: logtag.hh:64
virtual void writeTag(std::ostream &s) const override
write the tag to the stream
Definition: logtag.hh:94
std::ostream & hostRankWallUserLogtagFormatFunc(std::ostream &s)
logtag format function that includes hostname, rank (if available), wall time and CPU time
Definition: logtag.cc:179
~WithLogtag()
Definition: logtag.cc:65
void setLogtagFormatter(const std::shared_ptr< LogtagFormatterBase > &formatter)
set a new log tag formatter to be used by logtag()
Definition: logtag.cc:51
GeneralLogtagFormatter(const FormatFunc &formatFunc_)
constructor
Definition: logtag.hh:87
std::ostream & hostPidWallUserLogtagFormatFunc(std::ostream &s)
logtag format function that includes host name, pid, wall time and CPU time
Definition: logtag.cc:192
virtual void writeTag(std::ostream &s) const =0
function that writes the tag to a stream
std::ostream & operator<<(std::ostream &s, const TimeSpec &t)
insert a timespec into an output stream
Definition: clock.cc:39
A log tag formatter that wraps a unary formatting function or functor.
Definition: logtag.hh:76
const std::string s
Definition: function.hh:830
LocalTag & operator<<(const V &v)
append something to the static boilerplate message
Definition: logtag.hh:178
WithLogtag(const FormatFunc &formatFunc)
Definition: logtag.hh:135
Insert standard boilerplate into log messages.
Definition: logtag.hh:169
void logtagSetupMPI(bool syncWidthes)
collect MPI information for the logtag formatters
Definition: logtag.cc:88
std::shared_ptr< LogtagFormatterBase > makeGeneralLogtagFormatter(std::ostream &(&formatFunc)(std::ostream &))
Convenience function to create a GeneralLogtagFormatter.
Definition: logtag.cc:32