31 std::mutex write_lock;
68 "An exception occurred in LogStream::Prefix::~Prefix."));
110 *
std_out << (
"You still have content that was written to 'deallog' "
111 "but not flushed to the screen or a file while the "
112 "program is being terminated. This would lead to a "
113 "segmentation fault. Make sure you flush the "
114 "content of the 'deallog' object using 'std::endl' "
115 "before the end of the program.")
150 class QueryStreambuf :
public std::streambuf
157 , newline_written_(
false)
167 return newline_written_;
172 overflow(int_type ch)
override
174 newline_written_ =
true;
184 bool newline_written_;
189 std::ostream inject(&query_streambuf);
193 if (query_streambuf.flushed())
195 std::lock_guard<std::mutex> lock(write_lock);
201 at_newline = query_streambuf.newline_written();
207 *
file << stream.str() << std::flush;
219 const bool print_job_id,
220 const std::ios_base::fmtflags flags)
222 std::lock_guard<std::mutex> lock(log_lock);
233 std::lock_guard<std::mutex> lock(log_lock);
260 outstreams.
get()->setf(std::ios::showpoint | std::ios::left);
273 ExcMessage(
"You can't ask for the std::ostream object for the output "
274 "file if none had been set before."));
283 return (
file !=
nullptr);
291 static std::string empty_string;
309 pre += std::string(
":");
351 std::lock_guard<std::mutex> lock(log_lock);
362 std::lock_guard<std::mutex> lock(log_lock);
373 std::lock_guard<std::mutex> lock(log_lock);
381std::stack<std::string> &
385 std::stack<std::string> &local_prefixes =
prefixes.
get(exists);
393 local_prefixes = parent_prefixes.value();
396 return local_prefixes;
405 const std::thread::id thread = std::this_thread::get_id();
410 *
std_out <<
'[' << thread <<
']';
419 *
file <<
'[' << thread <<
']';
422 *
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)