58 maxErrors_(maxErrors),
71 errorSeverity severity,
76 messageStream(severity, maxErrors, use_stderr)
88 errorSeverity severity,
95 title_ = std::move(title);
113 if (communicator < 0)
121 const bool masterOnly
124 || ((severity_ & ~errorSeverity::USE_STDERR) == errorSeverity::INFO)
125 || ((severity_ & ~errorSeverity::USE_STDERR) == errorSeverity::WARNING)
144 const bool use_stderr =
147 || (severity_ & errorSeverity::USE_STDERR)
166 osptr = (use_stderr ? &
Perr : &
Pout);
171 (*osptr) << title_.c_str();
174 if (maxErrors_ && (++errorCount_ >= maxErrors_))
177 <<
"Too many errors..." 190 if (communicator < 0)
197 Perr<<
"** messageStream with comm:" << communicator <<
endl;
203 return this->stream(
nullptr, communicator);
213 return this->stream().stdStream();
221 const int afterVersion,
222 const char* functionName,
223 const char* sourceFileName,
224 const int sourceFileLineNumber
239 - (12 * (afterVersion/100) + (afterVersion % 100))
243 <<
">>> DEPRECATED after version " << afterVersion;
245 if (afterVersion < 1000)
248 os <<
". This is very old! <<<" <<
nl;
252 os <<
". This is about " << months <<
" months old. <<<" <<
nl;
261 os <<
" From " << functionName <<
nl;
265 os <<
" in file " << sourceFileName;
267 if (sourceFileLineNumber >= 0)
269 os <<
" at line " << sourceFileLineNumber;
282 const std::string& functionName,
283 const char* sourceFileName,
284 const int sourceFileLineNumber
289 if (!functionName.empty())
292 <<
" From " << functionName.c_str() <<
nl;
297 os <<
" in file " << sourceFileName;
299 if (sourceFileLineNumber >= 0)
301 os <<
" at line " << sourceFileLineNumber;
312 const char* functionName,
313 const char* sourceFileName,
314 const int sourceFileLineNumber
317 OSstream&
os = this->stream();
322 <<
" From " << functionName <<
nl;
327 os <<
" in file " << sourceFileName;
329 if (sourceFileLineNumber >= 0)
331 os <<
" at line " << sourceFileLineNumber;
342 const char* functionName,
343 const char* sourceFileName,
344 const int sourceFileLineNumber,
345 const std::string& ioFileName,
346 const label ioStartLineNumber,
347 const label ioEndLineNumber
350 OSstream&
os = operator()
357 os <<
"Reading \"" << ioFileName.c_str() <<
'"';
359 if (ioStartLineNumber >= 0)
361 os <<
" at line " << ioStartLineNumber;
363 if (ioStartLineNumber < ioEndLineNumber)
365 os <<
" to " << ioEndLineNumber;
377 const char* functionName,
378 const char* sourceFileName,
379 const int sourceFileLineNumber,
387 sourceFileLineNumber,
388 ioStream.relativeName(),
389 ioStream.lineNumber(),
397 const char* functionName,
398 const char* sourceFileName,
399 const int sourceFileLineNumber,
407 sourceFileLineNumber,
433 "--> FOAM Warning : ",
439 "--> FOAM Serious Error : ",
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const string & title() const noexcept
The title of this error type.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
Generic output stream using a standard (STL) stream.
label endLineNumber() const
Return line number of last token in dictionary.
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Warning of possible problem.
int infoDetailLevel
Global for selective suppression of Info output.
constexpr char nl
The newline '\n' character (0x0a)
std::ostream & stdStream()
Return std::ostream for output operations.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
OFstream Snull
Global predefined null output stream "/dev/null".
Handle output messages in a simple, consistent stream-based manner.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
static int redirect
The output redirection of messages.
messageStream SeriousError
Error stream (stdout output on all processes), with additional 'FOAM Serious Error' header text...
OSstream & deprecated(const int afterVersion, const char *functionName=nullptr, const char *sourceFileName=nullptr, const int sourceFileLineNumber=0)
Report deprecation (after specified API version) with 'From function-name, source file...
OSstream Sout
OSstream wrapped stdout (std::cout)
OSstream & stream(OSstream *alternative=nullptr, int communicator=-1)
Return OSstream for output operations.
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
errorManip< error > abort(error &err)
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation...
messageStream(errorSeverity severity, int maxErrors=0, bool use_stderr=false)
Construct untitled with given characteristics.
OBJstream os(runTime.globalPath()/outputName)
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text...
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
General information output (stdout)
OSstream & masterStream(int communicator)
Return OSstream for output operations on the master process only, Snull on other processes.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
OSstream Serr
OSstream wrapped stderr (std::cerr)
errorSeverity
Message type, error severity flags.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void printStack(Ostream &os, int size=-1)
Helper function to print a stack, with optional upper limit.
int severity_
The message type / error severity, possibly with USE_STDERR mask.
A class for handling character strings derived from std::string.
A serious problem - eg, data corruption.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static int level
The output level (verbosity) of messages.
label startLineNumber() const
Return line number of first token in dictionary.
string title_
The title of this error type.