16 #include <deal.II/base/logstream.h> 17 #include <deal.II/base/job_identifier.h> 18 #include <deal.II/base/thread_management.h> 26 DEAL_II_NAMESPACE_OPEN
71 ExcMessage(
"An exception occurred in LogStream::Prefix::~Prefix."));
112 if ((
this == &deallog) &&
file)
113 *
std_out << (
"You still have content that was written to 'deallog' " 114 "but not flushed to the screen or a file while the " 115 "program is being terminated. This would lead to a " 116 "segmentation fault. Make sure you flush the " 117 "content of the 'deallog' object using 'std::endl' " 118 "before the end of the program.")
154 class QueryStreambuf :
public std::streambuf
160 : flushed_(
false), newline_written_(
false)
167 bool newline_written()
169 return newline_written_;
172 int_type overflow(int_type ch)
174 newline_written_ =
true;
183 bool newline_written_;
188 std::ostream inject (&query_streambuf);
192 if (query_streambuf.flushed())
200 at_newline = query_streambuf.newline_written();
206 *
file << stream.str() << std::flush;
218 const bool print_job_id)
222 o.setf(std::ios::showpoint | std::ios::left);
257 outstreams.
get()->setf(std::ios::showpoint | std::ios::left);
270 ExcMessage(
"You can't ask for the std::ostream object for the output " 271 "file if none had been set before."));
280 return (
file !=
nullptr);
288 static std::string empty_string;
306 pre += std::string(
":");
377 std::stack<std::string> &
380 #ifdef DEAL_II_WITH_THREADS 382 std::stack<std::string> &local_prefixes =
prefixes.
get(exists);
388 const tbb::enumerable_thread_specific<std::stack<std::string> > &impl
393 const tbb::enumerable_thread_specific<std::stack<std::string> >::const_iterator first_elem
396 if (first_elem != impl.end())
398 local_prefixes = *first_elem;
402 return local_prefixes;
420 *
std_out <<
'[' << thread <<
']';
429 *
file <<
'[' << thread <<
']';
432 *
file << head <<
':';
436 DEAL_II_NAMESPACE_CLOSE
#define AssertNothrow(cond, exc)
std::streamsize precision(const std::streamsize prec)
unsigned int this_thread_id()
Threads::ThreadLocalStorage< std::stack< std::string > > prefixes
const std::string & get_prefix() const
unsigned int depth_file(const unsigned int n)
std::streamsize width(const std::streamsize wide)
bool log_thread_id(const bool flag)
std::ostream & get_file_stream()
std::ios::fmtflags flags(const std::ios::fmtflags f)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
tbb::enumerable_thread_specific< T > & get_implementation()
std::stack< std::string > & get_prefixes() const
unsigned int depth_console(const unsigned int n)
void attach(std::ostream &o, const bool print_job_id=true)
Prefix(const std::string &text)
std::ostream & get_console()
Threads::ThreadLocalStorage< std::shared_ptr< std::ostringstream > > outstreams
void push(const std::string &text)
SmartPointer< LogStream, LogStream::Prefix > stream
LogStream & operator<<(std::ostream &(*p)(std::ostream &))
std::ostringstream & get_stream()