Handle output messages in a simple, consistent stream-based manner. More...
Public Types | |
enum | errorSeverity { INFO = 1, INFO_STDERR, WARNING, SERIOUS, FATAL } |
Public Member Functions | |
messageStream (const string &title, const errorSeverity severity, const int maxErrors=0) | |
messageStream (const dictionary &dict) | |
const string & | title () const noexcept |
int | maxErrors () const noexcept |
int | maxErrors (int nErrors) noexcept |
OSstream & | stream (OSstream *alternative=nullptr) |
OSstream & | masterStream (const label communicator) |
std::ostream & | stdStream () |
operator OSstream & () | |
OSstream & | operator() () |
OSstream & | operator() (const string &functionName) |
OSstream & | operator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber=0) |
OSstream & | operator() (const string &functionName, const char *sourceFileName, const int sourceFileLineNumber=0) |
OSstream & | operator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const string &ioFileName, const label ioStartLineNumber=-1, const label ioEndLineNumber=-1) |
OSstream & | operator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &) |
OSstream & | operator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const dictionary &) |
Static Public Attributes | |
static int | level |
static int | redirect |
Protected Attributes | |
string | title_ |
errorSeverity | severity_ |
int | maxErrors_ |
int | errorCount_ |
Handle output messages in a simple, consistent stream-based manner.
The messageStream class is globally instantiated with a title string and a severity (which controls the program termination), optionally with a max number of errors before termination.
Errors, messages and other data are sent to the messageStream class in the standard manner.
For parallel applications, the output for 'standard' messages (Info, Warnings) is effectively suppressed on all sub-processes, which results in a single output message instead of a flood of output messages from each process. The error type of messages do, however, retain output on all processes, which ensures that parallel termination occurs correctly and the source of the problem is properly traceable to the originating processor.
Definition at line 69 of file messageStream.H.
enum errorSeverity |
Definition at line 74 of file messageStream.H.
messageStream | ( | const string & | title, |
const errorSeverity | severity, | ||
const int | maxErrors = 0 |
||
) |
Definition at line 40 of file messageStream.C.
|
explicit |
Definition at line 53 of file messageStream.C.
|
inlinenoexcept |
Definition at line 133 of file messageStream.H.
References messageStream::title_.
|
inlinenoexcept |
Definition at line 139 of file messageStream.H.
References messageStream::maxErrors_.
|
inlinenoexcept |
Definition at line 146 of file messageStream.H.
References messageStream::maxErrors_.
Foam::OSstream & stream | ( | OSstream * | alternative = nullptr | ) |
Definition at line 64 of file messageStream.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::infoDetailLevel, UPstream::master(), UPstream::parRun(), Foam::Perr, Foam::Pout, Foam::Serr, Foam::Snull, and Foam::Sout.
Referenced by GAMGAgglomeration::compactLevels(), messageStream::operator OSstream &(), and messageStream::operator()().
Foam::OSstream & masterStream | ( | const label | communicator | ) |
Definition at line 133 of file messageStream.C.
References Foam::endl(), UPstream::master(), Foam::Pout, error::printStack(), Foam::Snull, UPstream::warnComm, and UPstream::worldComm.
Referenced by smoothSolver::solve(), fvMatrix::fvSolver::solve(), GAMGSolver::solve(), fvMatrix< Type >::solveCoupled(), fvMatrix< Type >::solver(), fvMatrix< Type >::solveSegregated(), and fvMatrix< Type >::solveSegregatedOrCoupled().
std::ostream & stdStream | ( | ) |
Definition at line 150 of file messageStream.C.
Referenced by argList::argList(), argList::parse(), and argList::printUsage().
|
inline |
Definition at line 169 of file messageStream.H.
References messageStream::stream().
|
inline |
Definition at line 175 of file messageStream.H.
References messageStream::stream().
Foam::OSstream & operator() | ( | const string & | functionName | ) |
Definition at line 159 of file messageStream.C.
References Foam::nl, and os().
Foam::OSstream & operator() | ( | const char * | functionName, |
const char * | sourceFileName, | ||
const int | sourceFileLineNumber = 0 |
||
) |
Definition at line 176 of file messageStream.C.
References Foam::endl(), Foam::nl, and os().
Foam::OSstream & operator() | ( | const string & | functionName, |
const char * | sourceFileName, | ||
const int | sourceFileLineNumber = 0 |
||
) |
Definition at line 195 of file messageStream.C.
Foam::OSstream & operator() | ( | const char * | functionName, |
const char * | sourceFileName, | ||
const int | sourceFileLineNumber, | ||
const string & | ioFileName, | ||
const label | ioStartLineNumber = -1 , |
||
const label | ioEndLineNumber = -1 |
||
) |
Definition at line 211 of file messageStream.C.
References Foam::endl(), Foam::nl, and os().
Foam::OSstream & operator() | ( | const char * | functionName, |
const char * | sourceFileName, | ||
const int | sourceFileLineNumber, | ||
const IOstream & | ioStream | ||
) |
ioStream | Provides name and lineNumber |
Definition at line 245 of file messageStream.C.
Foam::OSstream & operator() | ( | const char * | functionName, |
const char * | sourceFileName, | ||
const int | sourceFileLineNumber, | ||
const dictionary & | dict | ||
) |
dict | Provides name, startLine, endLine |
Definition at line 265 of file messageStream.C.
References dict, dictionary::endLineNumber(), dictionary::relativeName(), and dictionary::startLineNumber().
|
protected |
Definition at line 91 of file messageStream.H.
Referenced by messageStream::title().
|
protected |
Definition at line 92 of file messageStream.H.
|
protected |
Definition at line 93 of file messageStream.H.
Referenced by messageStream::maxErrors().
|
protected |
Definition at line 94 of file messageStream.H.
|
static |
Definition at line 108 of file messageStream.H.
Referenced by IOobject::setBad(), error::write(), and IOerror::write().
|
static |
Definition at line 113 of file messageStream.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.