60 maxErrors_(maxErrors),
76 title_(
dict.
get<string>(
"title")),
77 severity_(errorSeverity::FATAL),
96 || ((severity_ & ~errorSeverity::USE_STDERR) == errorSeverity::INFO)
97 || ((severity_ & ~errorSeverity::USE_STDERR) == errorSeverity::WARNING)
110 const bool use_stderr =
113 || (severity_ & errorSeverity::USE_STDERR)
134 osptr = (use_stderr ? &
Perr : &
Pout);
139 (*osptr) << title_.c_str();
142 if (maxErrors_ && (++errorCount_ >= maxErrors_))
145 <<
"Too many errors..." 160 Perr<<
"** messageStream with comm:" << communicator <<
endl;
166 return this->stream();
175 return this->stream().stdStream();
183 const std::string& functionName
188 if (!functionName.empty())
191 <<
" From " << functionName.c_str() <<
nl;
200 const int afterVersion,
201 const char* functionName,
202 const char* sourceFileName,
203 const int sourceFileLineNumber
206 OSstream&
os = this->stream();
218 - (12 * (afterVersion/100) + (afterVersion % 100))
222 <<
">>> DEPRECATED after version " << afterVersion;
224 if (afterVersion < 1000)
227 os <<
". This is very old! <<<" <<
nl;
231 os <<
". This is about " << months <<
" months old. <<<" <<
nl;
240 os <<
" From " << functionName <<
nl;
244 os <<
" in file " << sourceFileName
245 <<
" at line " << sourceFileLineNumber <<
nl;
256 const char* functionName,
257 const char* sourceFileName,
258 const int sourceFileLineNumber
264 <<
" From " << functionName <<
nl 265 <<
" in file " << sourceFileName
266 <<
" at line " << sourceFileLineNumber <<
nl 275 const std::string& functionName,
276 const char* sourceFileName,
277 const int sourceFileLineNumber
282 functionName.c_str(),
291 const char* functionName,
292 const char* sourceFileName,
293 const int sourceFileLineNumber,
294 const std::string& ioFileName,
295 const label ioStartLineNumber,
296 const label ioEndLineNumber
306 os <<
"Reading \"" << ioFileName.c_str() <<
'"';
308 if (ioStartLineNumber >= 0)
310 os <<
" at line " << ioStartLineNumber;
312 if (ioStartLineNumber < ioEndLineNumber)
314 os <<
" to " << ioEndLineNumber;
326 const char* functionName,
327 const char* sourceFileName,
328 const int sourceFileLineNumber,
336 sourceFileLineNumber,
337 ioStream.relativeName(),
338 ioStream.lineNumber(),
346 const char* functionName,
347 const char* sourceFileName,
348 const int sourceFileLineNumber,
356 sourceFileLineNumber,
382 "--> FOAM Warning : ",
388 "--> 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...
messageStream(const char *title, errorSeverity severity, int maxErrors=0, bool use_stderr=false)
Construct from components.
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)
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...
OSstream & stream(OSstream *alternative=nullptr)
Return OSstream for output operations.
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...
OSstream & masterStream(const label communicator)
Return OSstream for output operations on the master process only, Snull on other processes.
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
General information output (stdout)
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 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.