33 std::mutex write_lock;
70 "An exception occurred in LogStream::Prefix::~Prefix."));
112 *
std_out << (
"You still have content that was written to 'deallog' "
113 "but not flushed to the screen or a file while the "
114 "program is being terminated. This would lead to a "
115 "segmentation fault. Make sure you flush the "
116 "content of the 'deallog' object using 'std::endl' "
117 "before the end of the program.")
152 class QueryStreambuf :
public std::streambuf
159 , newline_written_(
false)
169 return newline_written_;
174 overflow(int_type ch)
override
176 newline_written_ =
true;
186 bool newline_written_;
191 std::ostream inject(&query_streambuf);
195 if (query_streambuf.flushed())
197 std::lock_guard<std::mutex> lock(write_lock);
203 at_newline = query_streambuf.newline_written();
209 *
file << stream.str() << std::flush;
221 const bool print_job_id,
222 const std::ios_base::fmtflags flags)
224 std::lock_guard<std::mutex> lock(log_lock);
235 std::lock_guard<std::mutex> lock(log_lock);
262 outstreams.
get()->setf(std::ios::showpoint | std::ios::left);
275 ExcMessage(
"You can't ask for the std::ostream object for the output "
276 "file if none had been set before."));
285 return (
file !=
nullptr);
293 static std::string empty_string;
353 std::lock_guard<std::mutex> lock(log_lock);
364 std::lock_guard<std::mutex> lock(log_lock);
375 std::lock_guard<std::mutex> lock(log_lock);
383std::stack<std::string> &
387 std::stack<std::string> &local_prefixes =
prefixes.
get(exists);
395 local_prefixes = parent_prefixes.value();
398 return local_prefixes;
407 const std::thread::id thread = std::this_thread::get_id();
412 *
std_out <<
'[' << thread <<
']';
421 *
file <<
'[' << thread <<
']';
424 *
file << head <<
':';
static const JobIdentifier & get_dealjobid()
ObserverPointer< LogStream, LogStream::Prefix > stream
Prefix(const std::string &text)
std::thread::id parent_thread
std::streamsize width(const std::streamsize wide)
std::ostream & get_console()
friend LogStream & operator<<(LogStream &log, const T &t)
void push(const std::string &text)
Threads::ThreadLocalStorage< std::shared_ptr< std::ostringstream > > outstreams
std::ios::fmtflags flags(const std::ios::fmtflags f)
void attach(std::ostream &o, const bool print_job_id=true, const std::ios_base::fmtflags flags=std::ios::showpoint|std::ios::left)
std::streamsize precision(const std::streamsize prec)
std::ostream & get_file_stream()
unsigned int depth_console(const unsigned int n)
std::ostringstream & get_stream()
unsigned int depth_file(const unsigned int n)
bool log_thread_id(const bool flag)
Threads::ThreadLocalStorage< std::stack< std::string > > prefixes
std::stack< std::string > & get_prefixes() const
const std::string & get_prefix() const
std::optional< T > get_for_thread(const std::thread::id &id) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertNothrow(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)