4#ifndef DUNE_PDELAB_COMMON_LOGTAG_HH
5#define DUNE_PDELAB_COMMON_LOGTAG_HH
29 extern std::ostream &logtag(std::ostream &s);
33 extern std::ostream &hostPidWallUserLogtagFormatFunc(std::ostream &s);
42 extern std::ostream &hostRankWallUserLogtagFormatFunc(std::ostream &s);
45 extern std::ostream &nullFormatFunc(std::ostream &s);
58 extern void logtagSetupMPI(
bool syncWidthes =
true);
71 virtual void writeTag(std::ostream &s)
const = 0;
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>
102 makeGeneralLogtagFormatter(
const FormatFunc &formatFunc)
103 {
return std::make_shared<GeneralLogtagFormatter<FormatFunc> >(formatFunc); }
105 extern std::shared_ptr<LogtagFormatterBase>
106 makeGeneralLogtagFormatter(std::ostream &(&formatFunc)(std::ostream&));
109 extern const std::shared_ptr<LogtagFormatterBase> &getLogtagFormatter();
116 setLogtagFormatter(
const std::shared_ptr<LogtagFormatterBase> &formatter
117 = std::shared_ptr<LogtagFormatterBase>());
123 template<
class FormatFunc>
124 void setLogtagFormatFunc(
const FormatFunc &formatFunc)
125 { setLogtagFormatter(makeGeneralLogtagFormatter(formatFunc)); }
134 std::shared_ptr<LogtagFormatterBase> savedFormatter;
137 template<
class FormatFunc>
139 savedFormatter(getLogtagFormatter())
140 { setLogtagFormatFunc(formatFunc); }
177 inline const std::string &
str()
const {
return str_; }
190 inline std::ostream &operator<<(std::ostream &s,
const LocalTag &tag)
191 {
return s << logtag << tag.str(); }
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
temporarily use a different log tag format function
Definition: logtag.hh:133
Dune namespace.
Definition: alignedallocator.hh:13