mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add InfoErr stream. Same as Info, but with stderr instead of stdout
This commit is contained in:
committed by
Andrew Heather
parent
5213a4aa9d
commit
e3d4d79300
@ -200,48 +200,41 @@ Foam::messageStream::operator Foam::OSstream&()
|
|||||||
{
|
{
|
||||||
if (level)
|
if (level)
|
||||||
{
|
{
|
||||||
const bool collect = (severity_ == INFO || severity_ == WARNING);
|
const bool collect =
|
||||||
|
(
|
||||||
|
severity_ == INFO
|
||||||
|
|| severity_ == INFO_STDERR
|
||||||
|
|| severity_ == WARNING
|
||||||
|
);
|
||||||
|
|
||||||
// Report the error
|
|
||||||
|
// Could add guard with parRun
|
||||||
if (collect && !Pstream::master())
|
if (collect && !Pstream::master())
|
||||||
{
|
{
|
||||||
return Snull;
|
return Snull;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
OSstream& os =
|
||||||
|
(
|
||||||
|
(collect || !Pstream::parRun())
|
||||||
|
? ((severity_ == INFO_STDERR) ? Serr : Sout)
|
||||||
|
: Pout
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
if (!title().empty())
|
if (!title().empty())
|
||||||
{
|
{
|
||||||
if (collect || !Pstream::parRun())
|
os << title().c_str();
|
||||||
{
|
|
||||||
Sout<< title().c_str();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Pout<< title().c_str();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxErrors_)
|
if (maxErrors_ && (++errorCount_ >= maxErrors_))
|
||||||
{
|
|
||||||
++errorCount_;
|
|
||||||
|
|
||||||
if (errorCount_ >= maxErrors_)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Too many errors"
|
<< "Too many errors"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (collect || !Pstream::parRun())
|
return os;
|
||||||
{
|
|
||||||
return Sout;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Pout;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Snull;
|
return Snull;
|
||||||
@ -252,6 +245,8 @@ Foam::messageStream::operator Foam::OSstream&()
|
|||||||
|
|
||||||
Foam::messageStream Foam::Info("", messageStream::INFO);
|
Foam::messageStream Foam::Info("", messageStream::INFO);
|
||||||
|
|
||||||
|
Foam::messageStream Foam::InfoErr("", messageStream::INFO_STDERR);
|
||||||
|
|
||||||
Foam::messageStream Foam::Warning
|
Foam::messageStream Foam::Warning
|
||||||
(
|
(
|
||||||
"--> FOAM Warning : ",
|
"--> FOAM Warning : ",
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -76,10 +76,11 @@ public:
|
|||||||
//- Message type, or error severity flags
|
//- Message type, or error severity flags
|
||||||
enum errorSeverity
|
enum errorSeverity
|
||||||
{
|
{
|
||||||
INFO, //!< General information output, not necessarily an error.
|
INFO = 1, //!< General information output
|
||||||
WARNING, //!< Warning of possible problem.
|
WARNING, //!< Warning of possible problem.
|
||||||
SERIOUS, //!< A serious problem - eg, data corruption.
|
SERIOUS, //!< A serious problem - eg, data corruption.
|
||||||
FATAL //!< A fatal error.
|
FATAL, //!< A fatal error.
|
||||||
|
INFO_STDERR = INFO | 0x10, //!< Information, but on stderr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -228,6 +229,9 @@ extern int infoDetailLevel;
|
|||||||
//- Information stream (uses stdout - output is on the master only)
|
//- Information stream (uses stdout - output is on the master only)
|
||||||
extern messageStream Info;
|
extern messageStream Info;
|
||||||
|
|
||||||
|
//- Information stream (uses stderr - output is on the master only)
|
||||||
|
extern messageStream InfoErr;
|
||||||
|
|
||||||
//- Warning stream (uses stdout - output is on the master only),
|
//- Warning stream (uses stdout - output is on the master only),
|
||||||
//- with additional 'FOAM Warning' header text.
|
//- with additional 'FOAM Warning' header text.
|
||||||
extern messageStream Warning;
|
extern messageStream Warning;
|
||||||
|
|||||||
Reference in New Issue
Block a user